From 987c374b98dca3f0101da55f843063e488408ffb Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Fri, 29 Jul 2016 12:18:56 +0200 Subject: [PATCH] Minor: slightly better error message when trying to send to an unknown party. --- .../node/services/statemachine/StateMachineManager.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/node/src/main/kotlin/com/r3corda/node/services/statemachine/StateMachineManager.kt b/node/src/main/kotlin/com/r3corda/node/services/statemachine/StateMachineManager.kt index 64c7f2c423..e6b247d4d9 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/statemachine/StateMachineManager.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/statemachine/StateMachineManager.kt @@ -270,8 +270,10 @@ class StateMachineManager(val serviceHub: ServiceHubInternal, tokenizableService request.payload?.let { psm.logger.trace { "Sending message of type ${it.javaClass.name} using queue $queueID to ${request.destination} (${it.toString().abbreviate(50)})" } val node = serviceHub.networkMapCache.getNodeByLegalName(request.destination!!.name) - requireNotNull(node) { "Don't know about ${request.destination}" } - serviceHub.networkService.send(queueID, it, node!!.address) + if (node == null) { + throw IllegalArgumentException("Don't know about ${request.destination} but trying to send a message of type ${it.javaClass.name} on $queueID (${it.toString().abbreviate(50)})", request.stackTraceInCaseOfProblems) + } + serviceHub.networkService.send(queueID, it, node.address) } if (request is FiberRequest.NotExpectingResponse) { // We sent a message, but don't expect a response, so re-enter the continuation to let it keep going.