use of org.webpieces.router.impl.routers.SimulateInternalError in project webpieces by deanhiller.
the class DevRouteInvoker method invokeErrorController.
@Override
public XFuture<Void> invokeErrorController(InvokeInfo invokeInfo, Endpoint dynamicInfo, RouteData data) {
RouteInfoForInternalError error = (RouteInfoForInternalError) data;
Throwable exception = error.getException();
if (exception instanceof SimulateInternalError) {
// just use the original route at this point
return super.invokeErrorController(invokeInfo, dynamicInfo, data);
}
return invokeDevelopmentErrorPage(invokeInfo, error);
}
use of org.webpieces.router.impl.routers.SimulateInternalError in project webpieces by deanhiller.
the class DevRouteInvoker method invokeHtmlController.
@Override
public RouterStreamRef invokeHtmlController(InvokeInfo invokeInfo, StreamService dynamicInfo, RouteData data) {
// special case for if stuff didn't compile and we flag it
Throwable exc = (Throwable) invokeInfo.getRequestCtx().getRequest().requestState.get(ERROR_KEY);
if (exc != null) {
log.error("Could not compile your code", exc);
RouteInfoForInternalError error = new RouteInfoForInternalError(exc);
XFuture<Void> future = invokeDevelopmentErrorPage(invokeInfo, error);
XFuture<StreamWriter> writer = future.thenApply(voidd -> new NullWriter());
return new RouterStreamRef("notCompileError", writer, null);
}
if (invokeInfo.getRequestCtx().getRequest().queryParams.containsKey(DevelopmentController.INTERNAL_ERROR_KEY)) {
// need to simulate the error to show production page
throw new SimulateInternalError();
}
// }
return super.invokeHtmlController(invokeInfo, dynamicInfo, data);
}
Aggregations