Search in sources :

Example 6 with MatchResult

use of org.webpieces.router.impl.model.MatchResult in project webpieces by deanhiller.

the class RouteInvoker method internalServerError.

private CompletableFuture<Void> internalServerError(ErrorRoutes errorRoutes, Throwable exc, RequestContext requestCtx, ResponseStreamer responseCb, Object failedRoute) {
    try {
        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" + requestCtx.getRequest() + "\n\n" + failedRoute + ".  \n\nNext, server will try to render apps 5xx page\n\n", exc);
        SupressedExceptionLog.log(exc);
        RouteMeta meta = errorRoutes.fetchInternalServerErrorRoute();
        MatchResult res = new MatchResult(meta);
        return invokeImpl(res, meta.getService222(), requestCtx, responseCb);
    } catch (Throwable e) {
        //http 500...
        //return a completed future with the exception inside...
        CompletableFuture<Void> futExc = new CompletableFuture<Void>();
        futExc.completeExceptionally(e);
        return futExc;
    }
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) MatchResult(org.webpieces.router.impl.model.MatchResult)

Aggregations

MatchResult (org.webpieces.router.impl.model.MatchResult)6 CompletableFuture (java.util.concurrent.CompletableFuture)3 HaveRouteException (org.webpieces.router.impl.loader.HaveRouteException)2 HashMap (java.util.HashMap)1 Matcher (java.util.regex.Matcher)1 RouteMeta (org.webpieces.router.impl.RouteMeta)1 L1AllRouting (org.webpieces.router.impl.model.L1AllRouting)1