@Override public PipelineContinuationBehavior doExceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { // If this method is called, there's a (small) chance that the HttpProcessingState does not have a RequestInfo // set on it. Things like access logger and metrics listener need a RequestInfo in order to function, so // we should create a synthetic one. HttpProcessingState state = ChannelAttributes.getHttpProcessingStateForChannel(ctx).get(); if (state != null && state.getRequestInfo() == null) { state.setRequestInfo(RequestInfoImpl.dummyInstanceForUnknownRequests()); runnableWithTracingAndMdc( () -> logger.warn( "An error occurred before a RequestInfo could be created, so a synthetic RequestInfo indicating an " + "error will be used instead.", cause ), ctx ).run(); } return super.doExceptionCaught(ctx, cause); }
@Override public PipelineContinuationBehavior doExceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { // If this method is called, there's a (small) chance that the HttpProcessingState does not have a RequestInfo // set on it. Things like access logger and metrics listener need a RequestInfo in order to function, so // we should create a synthetic one. HttpProcessingState state = ChannelAttributes.getHttpProcessingStateForChannel(ctx).get(); if (state != null && state.getRequestInfo() == null) { state.setRequestInfo(RequestInfoImpl.dummyInstanceForUnknownRequests()); runnableWithTracingAndMdc( () -> logger.warn( "An error occurred before a RequestInfo could be created, so a synthetic RequestInfo indicating an " + "error will be used instead.", cause ), ctx ).run(); } return super.doExceptionCaught(ctx, cause); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { PipelineContinuationBehavior methodExecutionResponse; boolean shouldLinkAndUnlinkDTraceInfo = shouldLinkAndUnlinkDistributedTraceInfoForMethod( DO_EXCEPTION_CAUGHT, isDefaultDoExceptionCaughtImpl, forceEnableDTraceOnAllMethods, debugHandlerMethodCalls, ctx, null, cause ); Pair<Deque<Span>, Map<String, String>> origThreadInfo = null; try { if (shouldLinkAndUnlinkDTraceInfo) origThreadInfo = linkTracingAndMdcToCurrentThread(ctx); if (debugHandlerMethodCalls) logger.debug("!!!!!!!!!!!!!!!!! exceptionCaught for {}", this.getClass().getName()); methodExecutionResponse = doExceptionCaught(ctx, cause); } finally { if (shouldLinkAndUnlinkDTraceInfo) unlinkTracingAndMdcFromCurrentThread(ctx, origThreadInfo); } if (methodExecutionResponse == null || CONTINUE.equals(methodExecutionResponse)) super.exceptionCaught(ctx, cause); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { PipelineContinuationBehavior methodExecutionResponse; boolean shouldLinkAndUnlinkDTraceInfo = shouldLinkAndUnlinkDistributedTraceInfoForMethod( DO_EXCEPTION_CAUGHT, isDefaultDoExceptionCaughtImpl, forceEnableDTraceOnAllMethods, debugHandlerMethodCalls, ctx, null, cause ); Pair<Deque<Span>, Map<String, String>> origThreadInfo = null; try { if (shouldLinkAndUnlinkDTraceInfo) origThreadInfo = linkTracingAndMdcToCurrentThread(ctx); if (debugHandlerMethodCalls) logger.debug("!!!!!!!!!!!!!!!!! exceptionCaught for {}", this.getClass().getName()); methodExecutionResponse = doExceptionCaught(ctx, cause); } finally { if (shouldLinkAndUnlinkDTraceInfo) unlinkTracingAndMdcFromCurrentThread(ctx, origThreadInfo); } if (methodExecutionResponse == null || CONTINUE.equals(methodExecutionResponse)) super.exceptionCaught(ctx, cause); }