@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable e){ if (config.ioExceptionHandler().of(ctx, e)) { try { if (e instanceof IOException) { logger.trace("Connection closed Exception", e); } else if (e.getCause() != null && (e.getCause().getClass().equals(ClosedChannelException.class) || e.getCause().getClass().equals(IOException.class))) { logger.trace("Unexpected I/O Exception", e.getCause()); } else if (e.getCause() != null && e.getCause().getClass().equals(TooLongFrameException.class)) { logger.error("TooLongFrameException. The request will be closed, make sure you increase the Config.maxChunkContentLength() to a higher value.", e.getCause()); super.exceptionCaught(ctx, e); } else { logger.error("Unexpected and unhandled I/O Exception", e); super.exceptionCaught(ctx, e); } } finally { try { ctx.channel().close(); } catch (Exception ex) { logger.trace("", ex); } } } }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable e){ if (config.ioExceptionHandler().of(ctx, e)) { try { if (e instanceof IOException) { logger.trace("Connection closed Exception", e); } else if (e.getCause() != null && (e.getCause().getClass().equals(ClosedChannelException.class) || e.getCause().getClass().equals(IOException.class))) { logger.trace("Unexpected I/O Exception", e.getCause()); } else if (e.getCause() != null && e.getCause().getClass().equals(TooLongFrameException.class)) { logger.error("TooLongFrameException. The request will be closed, make sure you increase the Config.maxChunkContentLength() to a higher value.", e.getCause()); super.exceptionCaught(ctx, e); } else { logger.error("Unexpected and unhandled I/O Exception", e); super.exceptionCaught(ctx, e); } } finally { try { ctx.channel().close(); } catch (Exception ex) { logger.trace("", ex); } } } }