From 3094e441153d793136d300140936b4171355da17 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Fri, 19 Jan 2018 22:21:43 +0000 Subject: [PATCH] Dump exception to System.err (#213) --- .../src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt | 3 ++- .../com/r3/corda/networkmanage/hsm/utils/HsmErrors.kt | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt index 4ab7e0a7f7..a586ef5329 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt @@ -141,7 +141,8 @@ private fun startNetworkingMapSigningPolling(networkMapStorage: NetworkMapStorag private fun processError(exception: Exception) { val processed = mapCryptoServerException(exception) - System.err.println("An error occurred: ${processed.message}") + System.err.println("An error occurred:") + processed.printStackTrace() } private fun confirmedSign(selectedItems: List): Boolean { diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/HsmErrors.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/HsmErrors.kt index 10ecec3ee1..9a017b5675 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/HsmErrors.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/HsmErrors.kt @@ -33,9 +33,9 @@ object HsmErrors { fun mapCryptoServerException(exception: Exception): Exception { // Try to decode the error code val crypto = exception as? CryptoServerException ?: exception.cause as? CryptoServerException - if (crypto != null) { - return Exception("(CryptoServer) ${HsmErrors.errors[crypto.ErrorCode]}", exception) + return if (crypto != null) { + Exception("(CryptoServer) ${HsmErrors.errors[crypto.ErrorCode]}", exception) } else { - return exception + exception } } \ No newline at end of file