@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { ExceptionsHelper.maybeDieOnAnotherThread(cause); final Throwable unwrapped = ExceptionsHelper.unwrap(cause, ElasticsearchException.class); final Throwable newCause = unwrapped != null ? unwrapped : cause; Netty4TcpChannel tcpChannel = ctx.channel().attr(Netty4Transport.CHANNEL_KEY).get(); if (newCause instanceof Error) { transport.onException(tcpChannel, new Exception(newCause)); } else { transport.onException(tcpChannel, (Exception) newCause); } }
protected final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { final Throwable unwrapped = ExceptionsHelper.unwrap(cause, ElasticsearchException.class); final Throwable t = unwrapped != null ? unwrapped : cause; Channel channel = ctx.channel(); onException(channel.attr(CHANNEL_KEY).get(), t instanceof Exception ? (Exception) t : new ElasticsearchException(t)); }
protected final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { final Throwable unwrapped = ExceptionsHelper.unwrap(cause, ElasticsearchException.class); final Throwable t = unwrapped != null ? unwrapped : cause; Channel channel = ctx.channel(); onException(channel.attr(CHANNEL_KEY).get(), t instanceof Exception ? (Exception) t : new ElasticsearchException(t)); }
protected final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { final Throwable unwrapped = ExceptionsHelper.unwrap(cause, ElasticsearchException.class); final Throwable t = unwrapped != null ? unwrapped : cause; Channel channel = ctx.channel(); onException(channel.attr(CHANNEL_KEY).get(), t instanceof Exception ? (Exception) t : new ElasticsearchException(t)); }
@Override protected void onException(TcpChannel channel, Exception e) { if (lifecycle.started()) { Throwable cause = e; if(e instanceof DecoderException && e != null) { cause = e.getCause(); } errorHandler.logError(cause, false); if(cause instanceof NotSslRecordException) { logger.warn("Someone ({}) speaks transport plaintext instead of ssl, will close the channel", channel.getLocalAddress()); TcpChannel.closeChannel(channel, false); return; } else if (cause instanceof SSLException) { logger.error("SSL Problem "+cause.getMessage(),cause); TcpChannel.closeChannel(channel, false); return; } else if (cause instanceof SSLHandshakeException) { logger.error("Problem during handshake "+cause.getMessage()); TcpChannel.closeChannel(channel, false); return; } } super.onException(channel, e); }