Add `ClosedChannelException` to expected errors

This commit is contained in:
Chris Eager 2023-02-22 16:59:52 -06:00 committed by Chris Eager
parent 43f83076fa
commit a6d11789e9
1 changed files with 5 additions and 4 deletions

View File

@ -367,12 +367,13 @@ public class WebSocketConnection implements MessageAvailabilityListener, Displac
.orTimeout(sendFuturesTimeoutMillis, TimeUnit.MILLISECONDS))
.doOnError(e -> {
final String errorType;
if (!(e instanceof TimeoutException)) {
// TimeoutExceptions are expected, no need to log
if (e instanceof TimeoutException) {
errorType = "timeout";
} else if (e instanceof java.nio.channels.ClosedChannelException) {
errorType = "closedChannel";
} else {
logger.warn("Send message failed", e);
errorType = "other";
} else {
errorType = "timeout";
}
final Tags tags = Tags.of(
UserAgentTagUtil.getPlatformTag(client.getUserAgent()),