mirror of
https://github.com/corda/corda.git
synced 2025-05-31 06:31:08 +00:00
In CollectSignaturesFlow wrap ISE/IAE/AE in FlowException so the other side can find out the details of what check failed.
This commit is contained in:
parent
794ce03958
commit
1e1ebf1370
@ -196,7 +196,14 @@ abstract class SignTransactionFlow(val otherParty: Party,
|
|||||||
subFlow(ResolveTransactionsFlow(proposal.tx, otherParty))
|
subFlow(ResolveTransactionsFlow(proposal.tx, otherParty))
|
||||||
proposal.tx.toLedgerTransaction(serviceHub).verify()
|
proposal.tx.toLedgerTransaction(serviceHub).verify()
|
||||||
// Perform some custom verification over the transaction.
|
// Perform some custom verification over the transaction.
|
||||||
|
try {
|
||||||
checkTransaction(proposal)
|
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.
|
// All good. Unwrap the proposal.
|
||||||
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
|
* **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.
|
* 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.
|
* @param stx a partially signed transaction received from your counter-party.
|
||||||
* @throws FlowException if the proposed transaction fails the checks.
|
* @throws FlowException if the proposed transaction fails the checks.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user