-
Notifications
You must be signed in to change notification settings - Fork 130
[MINOR] Render handler exception to System.err instead of .out #334
[MINOR] Render handler exception to System.err instead of .out #334
Conversation
private void handleException(final Throwable throwable) { | ||
System.out.println(throwable); | ||
private void handleException(final Throwable exception) { | ||
System.err.println(String.format("Packet handler exception: %s.", exception.getMessage())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot, but this should be sent to a logger, not System.err
or System.out
and it should include the stack trace, so:
LOG.error("Packet handler exception", exception);
We may want to check the exception type though - IOException
is fairly expected in this area so probably should be debug level.
if (exception instanceof IOException) { | ||
LOG.debug("Packet handler exception", exception); | ||
} | ||
LOG.error("Packet handler exception", exception); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing an else - this will log IOException at both debug and error level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
4d7662d
to
c23eb26
Compare
27cf9df
to
ee3532e
Compare
PR description
This is somewhat of a drive-by amelioration. I was going to test it but this is actually kind of hard to test, and I didn't want to spend a lot of time trying to make a good test for this, so I almost didn't change it- but anyway- I in fact did test it once, by making the method from
private
topublic
so I know that it behaves as expected.Fixed Issue(s)