Skip to content

Commit

Permalink
do not print stack trace for electrum errors
Browse files Browse the repository at this point in the history
Those have little usefulness and are quite spammy.
  • Loading branch information
pm47 committed Dec 13, 2023
1 parent 1409cc1 commit 334dcfd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ElectrumClient(
listenJob = listen(socket)
true
} catch (ex: Throwable) {
logger.warning(ex) { "electrum connection handshake failed: " }
logger.warning { "electrum connection handshake failed: ${ex?.message}" }
val ioException = when (ex) {
is TcpSocket.IOException -> ex
else -> TcpSocket.IOException.Unknown(ex.message, ex)
Expand Down Expand Up @@ -111,7 +111,7 @@ class ElectrumClient(
socket
}
} catch (ex: Throwable) {
logger.warning(ex) { "could not connect to electrum server: " }
logger.warning { "could not connect to electrum server: ${ex?.message}" }
val ioException = when (ex) {
is TcpSocket.IOException -> ex
else -> TcpSocket.IOException.ConnectionRefused(ex)
Expand Down Expand Up @@ -160,7 +160,7 @@ class ElectrumClient(
// We use a SupervisorJob to ensure that our CoroutineExceptionHandler is used and exceptions don't propagate
// to our parent scope: we simply disconnect and wait for the application to initiate a reconnection.
val job = scope.launch(CoroutineName("electrum-client") + SupervisorJob() + CoroutineExceptionHandler { _, ex ->
logger.warning(ex) { "electrum connection error: " }
logger.warning { "electrum connection error: ${ex?.message}" }
socket.close()
val ioException = when (ex) {
is TcpSocket.IOException -> ex
Expand Down

0 comments on commit 334dcfd

Please sign in to comment.