diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/lifecycle/NodeLifecycleEventsDistributor.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/lifecycle/NodeLifecycleEventsDistributor.kt index 4672ff85ac..7c2454c857 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/lifecycle/NodeLifecycleEventsDistributor.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/lifecycle/NodeLifecycleEventsDistributor.kt @@ -98,11 +98,12 @@ class NodeLifecycleEventsDistributor : Closeable { orderedSnapshot.forEach { log.debug("Distributing event $event to: $it") val updateResult = it.update(event) - if (updateResult.isSuccess) { - log.debug("Event $event distribution outcome: $updateResult") - } else { - log.error("Failed to distribute event $event, failure outcome: $updateResult") - handlePossibleFatalTermination(event, updateResult as Try.Failure) + when(updateResult) { + is Try.Success -> log.debug("Event $event distribution outcome: $updateResult") + is Try.Failure -> { + log.error("Failed to distribute event $event, failure outcome: $updateResult", updateResult.exception) + handlePossibleFatalTermination(event, updateResult) + } } } result.set(null)