Ejemplo n.º 1
0
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
   if (!isIgnorableException(cause)) {
     cause.printStackTrace();
     if (ctx.channel().isActive()) {
       sendError(ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR);
     }
   }
 }
Ejemplo n.º 2
0
 private boolean isIgnorableException(Throwable throwable) {
   // There really does not seem to be a better way of detecting this kind of exception
   return throwable instanceof IOException
       && throwable.getMessage().equals("Connection reset by peer");
 }