From 1e1ebf137011d6ee481c315738aadf395f19c732 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Wed, 17 May 2017 19:40:31 +0200 Subject: [PATCH] In CollectSignaturesFlow wrap ISE/IAE/AE in FlowException so the other side can find out the details of what check failed. --- .../kotlin/net/corda/flows/CollectSignaturesFlow.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/net/corda/flows/CollectSignaturesFlow.kt b/core/src/main/kotlin/net/corda/flows/CollectSignaturesFlow.kt index 69cbf7d221..acfbba8541 100644 --- a/core/src/main/kotlin/net/corda/flows/CollectSignaturesFlow.kt +++ b/core/src/main/kotlin/net/corda/flows/CollectSignaturesFlow.kt @@ -196,7 +196,14 @@ abstract class SignTransactionFlow(val otherParty: Party, subFlow(ResolveTransactionsFlow(proposal.tx, otherParty)) proposal.tx.toLedgerTransaction(serviceHub).verify() // Perform some custom verification over the transaction. - checkTransaction(proposal) + try { + checkTransaction(proposal) + } catch(e: Exception) { + if (e is IllegalStateException || e is IllegalArgumentException || e is AssertionError) + throw FlowException(e) + else + throw e + } // All good. Unwrap the proposal. proposal } @@ -234,6 +241,9 @@ abstract class SignTransactionFlow(val otherParty: Party, * **WARNING**: If appropriate checks, such as the ones listed above, are not defined then it is likely that your * node will sign any transaction if it conforms to the contract code in the transaction's referenced contracts. * + * [IllegalArgumentException], [IllegalStateException] and [AssertionError] will be caught and rethrown as flow + * exceptions i.e. the other side will be given information about what exact check failed. + * * @param stx a partially signed transaction received from your counter-party. * @throws FlowException if the proposed transaction fails the checks. */