Prevent exception causes showing up as null in logs (#1018)

* Passing exception messages via constructor instead of overriding toString
This commit is contained in:
Andrius Dagys
2017-07-14 20:40:21 +01:00
committed by GitHub
parent a56540a3d6
commit 7aafcf8c57
6 changed files with 39 additions and 43 deletions

View File

@ -61,8 +61,8 @@ class MyValidatingNotaryFlow(otherSide: Party, service: MyCustomValidatingNotary
private fun checkSignatures(stx: SignedTransaction) {
try {
stx.verifySignatures(serviceHub.myInfo.notaryIdentity.owningKey)
} catch(e: SignedTransaction.SignaturesMissingException) {
throw NotaryException(NotaryError.SignaturesMissing(e))
} catch(e: SignatureException) {
throw NotaryException(NotaryError.TransactionInvalid(e))
}
}
@ -75,8 +75,8 @@ class MyValidatingNotaryFlow(otherSide: Party, service: MyCustomValidatingNotary
return ltx
} catch (e: Exception) {
throw when (e) {
is TransactionVerificationException -> NotaryException(NotaryError.TransactionInvalid(e.toString()))
is SignatureException -> NotaryException(NotaryError.SignaturesInvalid(e.toString()))
is TransactionVerificationException,
is SignatureException -> NotaryException(NotaryError.TransactionInvalid(e))
else -> e
}
}