mirror of
https://github.com/corda/corda.git
synced 2025-06-16 22:28:15 +00:00
FlowException serialised over RPC (subtypes are flattened), and improvement to startFlow RPC for correct exception handling
This commit is contained in:
@ -21,7 +21,6 @@ import net.corda.core.getOrThrow
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.node.NodeInfo
|
||||
import net.corda.core.serialization.OpaqueBytes
|
||||
import net.corda.core.toFuture
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.explorer.model.CashTransaction
|
||||
import net.corda.explorer.model.IssuerModel
|
||||
@ -101,7 +100,7 @@ class NewTransaction : Fragment() {
|
||||
rpcProxy.value!!.startFlow(::CashFlow, it)
|
||||
}
|
||||
val response = try {
|
||||
handle?.returnValue?.toFuture()?.getOrThrow()
|
||||
handle?.returnValue?.getOrThrow()
|
||||
} catch (e: FlowException) {
|
||||
e
|
||||
}
|
||||
|
@ -7,12 +7,11 @@ import net.corda.core.contracts.Issued
|
||||
import net.corda.core.contracts.PartyAndReference
|
||||
import net.corda.core.contracts.USD
|
||||
import net.corda.core.crypto.Party
|
||||
import net.corda.core.flows.FlowException
|
||||
import net.corda.core.getOrThrow
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.serialization.OpaqueBytes
|
||||
import net.corda.core.toFuture
|
||||
import net.corda.flows.CashCommand
|
||||
import net.corda.flows.CashException
|
||||
import net.corda.flows.CashFlow
|
||||
import net.corda.loadtest.LoadTest
|
||||
import net.corda.loadtest.NodeHandle
|
||||
@ -208,9 +207,9 @@ val crossCashTest = LoadTest<CrossCashCommand, CrossCashState>(
|
||||
|
||||
execute = { command ->
|
||||
try {
|
||||
val result = command.node.connection.proxy.startFlow(::CashFlow, command.command).returnValue.toFuture().getOrThrow()
|
||||
val result = command.node.connection.proxy.startFlow(::CashFlow, command.command).returnValue.getOrThrow()
|
||||
log.info("Success: $result")
|
||||
} catch (e: CashException) {
|
||||
} catch (e: FlowException) {
|
||||
log.error("Failure", e)
|
||||
}
|
||||
},
|
||||
|
@ -7,11 +7,10 @@ import net.corda.client.mock.replicatePoisson
|
||||
import net.corda.contracts.asset.Cash
|
||||
import net.corda.core.contracts.USD
|
||||
import net.corda.core.crypto.Party
|
||||
import net.corda.core.flows.FlowException
|
||||
import net.corda.core.getOrThrow
|
||||
import net.corda.core.messaging.startFlow
|
||||
import net.corda.core.toFuture
|
||||
import net.corda.flows.CashCommand
|
||||
import net.corda.flows.CashException
|
||||
import net.corda.flows.CashFlow
|
||||
import net.corda.loadtest.LoadTest
|
||||
import net.corda.loadtest.NodeHandle
|
||||
@ -63,9 +62,9 @@ val selfIssueTest = LoadTest<SelfIssueCommand, SelfIssueState>(
|
||||
|
||||
execute = { command ->
|
||||
try {
|
||||
val result = command.node.connection.proxy.startFlow(::CashFlow, command.command).returnValue.toFuture().getOrThrow()
|
||||
val result = command.node.connection.proxy.startFlow(::CashFlow, command.command).returnValue.getOrThrow()
|
||||
log.info("Success: $result")
|
||||
} catch (e: CashException) {
|
||||
} catch (e: FlowException) {
|
||||
log.error("Failure", e)
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user