use of org.webpieces.router.api.exceptions.SpecificRouterInvokeException in project webpieces by deanhiller.
the class DScopedRouter method tryRenderWebAppErrorControllerResult.
private XFuture<StreamWriter> tryRenderWebAppErrorControllerResult(RequestContext ctx, ProxyStreamHandle handler, Throwable t) {
if (ExceptionWrap.isChannelClosed(t)) {
// if the socket was closed before we responded, do not log a failure
if (log.isTraceEnabled())
log.trace("async exception due to socket being closed", t);
return XFuture.<StreamWriter>completedFuture(new NullStreamWriter());
}
String failedRoute = "<Unknown Route>";
if (t instanceof SpecificRouterInvokeException)
failedRoute = ((SpecificRouterInvokeException) t).getMatchInfo() + "";
if (!(t instanceof SimulateInternalError)) {
log.error("There is three parts to this error message... request, route found, and the exception " + "message. You should\nread the exception message below as well as the RouterRequest and RouteMeta.\n\n" + ctx.getRequest() + "\n\n" + failedRoute + ". \n\nNext, server will try to render apps 5xx page\n\n", t);
SupressedExceptionLog.log(log, t);
}
// page so in that case, fail, and cancel the stream
if (handler.hasSentResponseAlready()) {
RstStreamFrame frame = new RstStreamFrame();
frame.setKnownErrorCode(Http2ErrorCode.CANCEL);
handler.cancel(frame);
return XFuture.completedFuture(new NullStreamWriter());
}
return invokeWebAppErrorController(t, ctx, handler, failedRoute);
}
Aggregations