Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

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

Merged
merged 4 commits into from
Nov 30, 2018

Conversation

smatthewenglish
Copy link
Contributor

@smatthewenglish smatthewenglish commented Nov 29, 2018

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 to public so I know that it behaves as expected.

Fixed Issue(s)

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()));
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@smatthewenglish smatthewenglish merged commit 7a40843 into PegaSysEng:master Nov 30, 2018
shemnon added a commit that referenced this pull request Nov 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants