@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { LOG.error("zuul filter chain handler caught exception. cause=" + String.valueOf(cause), cause); if (zuulRequest != null && !isClientChannelClosed(cause)) { final SessionContext zuulCtx = zuulRequest.getContext(); zuulCtx.setError(cause); zuulCtx.setShouldSendErrorResponse(true); sendResponse(FAILURE_LOCAL, 500, ctx); } else { fireEndpointFinish(true); ctx.close(); } }
protected String getEndPointName(final SessionContext zuulCtx) { if (zuulCtx.shouldSendErrorResponse()) { zuulCtx.setShouldSendErrorResponse(false); zuulCtx.setErrorResponseSent(true); final String errEndPointName = zuulCtx.getErrorEndpoint(); return (Strings.isNullOrEmpty(errEndPointName)) ? DEFAULT_ERROR_ENDPOINT.get() : errEndPointName; } else { return zuulCtx.getEndpoint(); } }
zuulRequest.getContext().setShouldSendErrorResponse(true);
protected O handleFilterException(final I inMesg, final ZuulFilter<I, O> filter, final Throwable ex) { inMesg.getContext().setError(ex); if (filter.filterType() == ENDPOINT) { inMesg.getContext().setShouldSendErrorResponse(true); } recordFilterError(inMesg, filter, ex); return filter.getDefaultOutput(inMesg); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { LOG.error("zuul filter chain handler caught exception. cause=" + String.valueOf(cause), cause); if (zuulRequest != null && !isClientChannelClosed(cause)) { final SessionContext zuulCtx = zuulRequest.getContext(); zuulCtx.setError(cause); zuulCtx.setShouldSendErrorResponse(true); sendResponse(FAILURE_LOCAL, 500, ctx); } else { fireEndpointFinish(true); ctx.close(); } }
protected String getEndPointName(final SessionContext zuulCtx) { if (zuulCtx.shouldSendErrorResponse()) { zuulCtx.setShouldSendErrorResponse(false); zuulCtx.setErrorResponseSent(true); final String errEndPointName = zuulCtx.getErrorEndpoint(); return (Strings.isNullOrEmpty(errEndPointName)) ? DEFAULT_ERROR_ENDPOINT.get() : errEndPointName; } else { return zuulCtx.getEndpoint(); } }
zuulCtx.setShouldSendErrorResponse(true);
zuulRequest.getContext().setShouldSendErrorResponse(true);
protected O handleFilterException(final I inMesg, final ZuulFilter<I, O> filter, final Throwable ex) { inMesg.getContext().setError(ex); if (filter.filterType() == ENDPOINT) { inMesg.getContext().setShouldSendErrorResponse(true); } recordFilterError(inMesg, filter, ex); return filter.getDefaultOutput(inMesg); }
zuulCtx.setShouldSendErrorResponse(true);
protected ZuulException proxyError(HttpRequestMessage zuulReq, Throwable t, String errorCauseMsg) { // Flag this as a proxy failure in the RequestContext. Error filter will then use this flag. zuulReq.getContext().setShouldSendErrorResponse(true); LOG.error(String.format("Error making http request to Origin. restClientName=%s, url=%s", this.name, zuulReq.getPathAndQuery()), t); if (errorCauseMsg == null) { if (t.getCause() != null) { errorCauseMsg = t.getCause().getMessage(); } } if (errorCauseMsg == null) errorCauseMsg = "unknown"; return new ZuulException("Proxying error", t, errorCauseMsg); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { LOG.error("zuul filter chain handler caught exception. cause=" + String.valueOf(cause), cause); if (zuulRequest != null && !isClientChannelClosed(cause)) { final SessionContext zuulCtx = zuulRequest.getContext(); zuulCtx.setError(cause); zuulCtx.setShouldSendErrorResponse(true); sendResponse(FAILURE_LOCAL, 500, ctx); } else { fireEndpointFinish(true); ctx.close(); } }
protected String getEndPointName(final SessionContext zuulCtx) { if (zuulCtx.shouldSendErrorResponse()) { zuulCtx.setShouldSendErrorResponse(false); zuulCtx.setErrorResponseSent(true); final String errEndPointName = zuulCtx.getErrorEndpoint(); return (Strings.isNullOrEmpty(errEndPointName)) ? DEFAULT_ERROR_ENDPOINT.get() : errEndPointName; } else { return zuulCtx.getEndpoint(); } }
protected O handleFilterException(final I inMesg, final ZuulFilter<I, O> filter, final Throwable ex) { inMesg.getContext().setError(ex); if (filter.filterType() == ENDPOINT) { inMesg.getContext().setShouldSendErrorResponse(true); } recordFilterError(inMesg, filter, ex); return filter.getDefaultOutput(inMesg); }
zuulCtx.setShouldSendErrorResponse(true);