Skip to content

Commit

Permalink
Simplify code in ExceptionLoggingHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed Sep 15, 2016
1 parent 8c8b815 commit 46c8d8f
Showing 1 changed file with 8 additions and 9 deletions.
Expand Up @@ -38,14 +38,13 @@ public ExceptionLoggingHandler( Log log )
@Override
public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause ) throws Exception
{
if ( ctx != null )
{
log.error( format( "Failed to process message on channel %s.", ctx.channel() ), cause );
}
else
{
log.error( format( "Failed to process message on a null channel." ), cause );
}
ctx.fireExceptionCaught(cause);
log.error( message( ctx ), cause );
ctx.fireExceptionCaught( cause );
}

private String message( ChannelHandlerContext ctx )
{
return ctx != null ? format( "Failed to process message on channel %s.", ctx.channel() )
: "Failed to process message on a null channel.";
}
}

0 comments on commit 46c8d8f

Please sign in to comment.