FlowException serialised over RPC (subtypes are flattened), and improvement to startFlow RPC for correct exception handling

This commit is contained in:
Shams Asari
2017-02-01 21:27:06 +00:00
parent 56dbf1e844
commit b86c80691e
26 changed files with 261 additions and 143 deletions

View File

@ -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
}

View File

@ -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)
}
},

View File

@ -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)
}
},