mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
ENT-4090: move startFlow into try block so exception is caught and managed (#5519)
This commit is contained in:
parent
9c8048008f
commit
be6824dac4
@ -20,7 +20,6 @@ import net.corda.core.contracts.withoutIssuer
|
|||||||
import net.corda.core.flows.FlowException
|
import net.corda.core.flows.FlowException
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.identity.PartyAndCertificate
|
import net.corda.core.identity.PartyAndCertificate
|
||||||
import net.corda.core.messaging.FlowHandle
|
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
@ -94,15 +93,14 @@ class NewTransaction : Fragment() {
|
|||||||
initOwner(window)
|
initOwner(window)
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
val handle: FlowHandle<AbstractCashFlow.Result> = when (request) {
|
|
||||||
is IssueAndPaymentRequest -> rpcProxy.value!!.startFlow(::CashIssueAndPaymentFlow, request)
|
|
||||||
is PaymentRequest -> rpcProxy.value!!.startFlow(::CashPaymentFlow, request)
|
|
||||||
is ExitRequest -> rpcProxy.value!!.startFlow(::CashExitFlow, request)
|
|
||||||
else -> throw IllegalArgumentException("Unexpected request type: $request")
|
|
||||||
}
|
|
||||||
runAsync {
|
runAsync {
|
||||||
try {
|
try {
|
||||||
handle.returnValue.getOrThrow()
|
when (request) {
|
||||||
|
is IssueAndPaymentRequest -> rpcProxy.value!!.startFlow(::CashIssueAndPaymentFlow, request)
|
||||||
|
is PaymentRequest -> rpcProxy.value!!.startFlow(::CashPaymentFlow, request)
|
||||||
|
is ExitRequest -> rpcProxy.value!!.startFlow(::CashExitFlow, request)
|
||||||
|
else -> throw IllegalArgumentException("Unexpected request type: $request")
|
||||||
|
}.returnValue.getOrThrow()
|
||||||
} finally {
|
} finally {
|
||||||
dialog.dialogPane.isDisable = false
|
dialog.dialogPane.isDisable = false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user