Improve exception logging for some general exception handlers.

This commit is contained in:
Jarl Fransson 2016-10-16 23:16:37 +02:00 committed by Andreas Schildbach
parent 814248a966
commit 072106a53b
4 changed files with 4 additions and 4 deletions

View file

@ -959,7 +959,7 @@ public class Peer extends PeerSocketHandler {
// Start the operation.
sendMessage(getdata);
} catch (Exception e) {
log.error("{}: Couldn't send getdata in downloadDependencies({})", this, tx.getHash());
log.error("{}: Couldn't send getdata in downloadDependencies({})", this, tx.getHash(), e);
resultFuture.setException(e);
return resultFuture;
} finally {

View file

@ -331,7 +331,7 @@ public class TransactionOutput extends ChildMessage {
}
} catch (ScriptException e) {
// Just means we didn't understand the output of this transaction: ignore it.
log.debug("Could not parse tx output script: {}", e.toString());
log.debug("Could not parse tx {} output script: {}", parent != null ? parent.getHash() : "(no parent)", e.toString());
return false;
}
}

View file

@ -232,7 +232,7 @@ class ConnectionHandler implements MessageWriteTarget {
// This can happen eg if the channel closes while the thread is about to get killed
// (ClosedByInterruptException), or if handler.connection.receiveBytes throws something
Throwable t = Throwables.getRootCause(e);
log.warn("Error handling SelectionKey: {}", t.getMessage() != null ? t.getMessage() : t.getClass().getName());
log.warn("Error handling SelectionKey: {} {}", t.getClass().getName(), t.getMessage() != null ? t.getMessage() : "", e);
handler.closeConnection();
}
}

View file

@ -77,7 +77,7 @@ public class NioClientManager extends AbstractExecutionThreadService implements
// may cause this. Otherwise it may be any arbitrary kind of connection failure.
// Calling sc.socket().getRemoteSocketAddress() here throws an exception, so we can only log the error itself
Throwable cause = Throwables.getRootCause(e);
log.warn("Failed to connect with exception: {}: {}", cause.getClass().getName(), cause.getMessage());
log.warn("Failed to connect with exception: {}: {}", cause.getClass().getName(), cause.getMessage(), e);
handler.closeConnection();
data.future.setException(cause);
data.future = null;