mirror of
https://github.com/corda/corda.git
synced 2025-03-10 22:44:20 +00:00
Don't propagate internal notary service errors to the client (#2368)
This commit is contained in:
parent
1367cd4adb
commit
55b7035a44
@ -158,7 +158,7 @@ class NotaryFlow {
|
|||||||
*/
|
*/
|
||||||
data class TransactionParts(val id: SecureHash, val inputs: List<StateRef>, val timestamp: TimeWindow?, val notary: Party?)
|
data class TransactionParts(val id: SecureHash, val inputs: List<StateRef>, val timestamp: TimeWindow?, val notary: Party?)
|
||||||
|
|
||||||
class NotaryException(val error: NotaryError) : FlowException("Error response from Notary - $error")
|
class NotaryException(val error: NotaryError) : FlowException("Unable to notarise: $error")
|
||||||
|
|
||||||
@CordaSerializable
|
@CordaSerializable
|
||||||
sealed class NotaryError {
|
sealed class NotaryError {
|
||||||
@ -166,7 +166,7 @@ sealed class NotaryError {
|
|||||||
override fun toString() = "One or more input states for transaction $txId have been used in another transaction"
|
override fun toString() = "One or more input states for transaction $txId have been used in another transaction"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Thrown if the time specified in the [TimeWindow] command is outside the allowed tolerance. */
|
/** Occurs when time specified in the [TimeWindow] command is outside the allowed tolerance. */
|
||||||
object TimeWindowInvalid : NotaryError()
|
object TimeWindowInvalid : NotaryError()
|
||||||
|
|
||||||
data class TransactionInvalid(val cause: Throwable) : NotaryError() {
|
data class TransactionInvalid(val cause: Throwable) : NotaryError() {
|
||||||
@ -174,4 +174,8 @@ sealed class NotaryError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object WrongNotary : NotaryError()
|
object WrongNotary : NotaryError()
|
||||||
|
|
||||||
|
data class General(val cause: String): NotaryError() {
|
||||||
|
override fun toString() = cause
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,9 @@ abstract class TrustedAuthorityNotaryService : NotaryService() {
|
|||||||
log.warn("Notary conflicts for $txId: $conflicts")
|
log.warn("Notary conflicts for $txId: $conflicts")
|
||||||
throw notaryException(txId, e)
|
throw notaryException(txId, e)
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
log.error("Internal error", e)
|
||||||
|
throw NotaryException(NotaryError.General("Service unavailable, please try again later"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user