Skip to content

Commit

Permalink
Don't repeat exception cause message when attaching the exception to …
Browse files Browse the repository at this point in the history
…the status

The default "OnConsoleStatusListener" already appends the cause's message when printing tth status on the console. Addining it in the original message will cause duplicates on the console.
Those not relying on the "OnConsoleStatusLisener" should simply retrieve additional information from the status  throwable if any (what they probaby already do for ErrorStatus anyway...)
  • Loading branch information
brenuart committed Sep 29, 2021
1 parent e8d8785 commit cecbad7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public void onEvent(LogEvent<Event> logEvent, long sequence, boolean endOfBatch)
/*
* Encoding threw an exception. Warn and drop event before it becomes a "poison".
*/
addWarn(peerId + "Encoder failed to encode event: " + e.getMessage() + ". Dropping event.", e.getCause());
addWarn(peerId + "Encoder failed to encode event. Dropping event.", e.getCause());
fireEventSendFailure(logEvent.event, e.getCause());
break;

Expand All @@ -583,7 +583,7 @@ public void onEvent(LogEvent<Event> logEvent, long sequence, boolean endOfBatch)
* Any other exception is thrown by the socket stream (or bug in the code).
* Re-open the socket and get a fresh new stream.
*/
addWarn(peerId + "Unable to send event: " + e.getMessage() + ". Reconnecting.", e);
addWarn(peerId + "Unable to send event. Reconnecting.", e);
reopenSocket();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ public void testEncoderThrowsException() throws Exception {
// A warn status is emitted
assertThat(statusManager.getCopyOfStatusList()).anySatisfy(status -> {
assertThat(status.getLevel()).isEqualTo(Status.WARN);
assertThat(status.getMessage()).contains("Encoder failed to encode event:");
assertThat(status.getMessage()).contains("Encoder failed to encode event. Dropping event.");
});
}

Expand Down Expand Up @@ -700,7 +700,7 @@ public void testStreamingEncoderThrowsException() throws Exception {
// A warn status is emitted
assertThat(statusManager.getCopyOfStatusList()).anySatisfy(status -> {
assertThat(status.getLevel()).isEqualTo(Status.WARN);
assertThat(status.getMessage()).contains("Encoder failed to encode event:");
assertThat(status.getMessage()).contains("Encoder failed to encode event. Dropping event.");
});
}

Expand Down

0 comments on commit cecbad7

Please sign in to comment.