Dump exception to System.err (#213)

This commit is contained in:
Ross Nicoll 2018-01-19 22:21:43 +00:00 committed by Shams Asari
parent 5dc15b8032
commit 3094e44115
2 changed files with 5 additions and 4 deletions

View File

@ -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<ApprovedCertificateRequestData>): Boolean {

View File

@ -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
}
}