[MINOR] Render handler exception to System.err instead of .out (#334)

* render error message to System.err instead of .out

* log and check exception type

* add else

* simplification of explanitory comment
S. Matthew English 6 years ago committed by GitHub
parent b8dbfd50fc
commit 7a40843ada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/PeerDiscoveryAgent.java

@ -37,6 +37,7 @@ import tech.pegasys.pantheon.ethereum.p2p.wire.messages.DisconnectMessage;
import tech.pegasys.pantheon.util.NetworkUtility; import tech.pegasys.pantheon.util.NetworkUtility;
import tech.pegasys.pantheon.util.bytes.BytesValue; import tech.pegasys.pantheon.util.bytes.BytesValue;
import java.io.IOException;
import java.net.BindException; import java.net.BindException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketException; import java.net.SocketException;
@ -222,12 +223,16 @@ public class PeerDiscoveryAgent implements DisconnectCallback {
} }
/** /**
* This is the exception handler for uncontrolled exceptions ocurring in the packet handlers. * For uncontrolled exceptions occurring in the packet handlers.
* *
* @param throwable the exception that was raised * @param exception the exception that was raised
*/ */
private void handleException(final Throwable throwable) { private void handleException(final Throwable exception) {
System.out.println(throwable); if (exception instanceof IOException) {
LOG.debug("Packet handler exception", exception);
} else {
LOG.error("Packet handler exception", exception);
}
} }
/** /**

Loading…
Cancel
Save