/** * Maps 500 internal server errors to the provided custom page */ public static void internalServerError(String page) { getInstance().internalServerError(page); }
/** * Maps 500 internal server errors to the provided route. */ public static void internalServerError(Route route) { getInstance().internalServerError(route); }
/** * Maps 500 internal server errors to the provided custom page */ public static void internalServerError(String page) { getInstance().internalServerError(page); }
/** * Maps 500 internal server errors to the provided route. */ public static void internalServerError(Route route) { getInstance().internalServerError(route); }
private void configureExceptionHanding() { service.notFound((req, res) -> ErrorResponder.builder() .statusCode(NOT_FOUND_404) .type(NOT_FOUND) .message(String.format("%s %s can not be found", req.requestMethod(), req.pathInfo())) .asString()); service.internalServerError((req, res) -> ErrorResponder.builder() .statusCode(INTERNAL_SERVER_ERROR_500) .type(SERVER_ERROR) .message("WebAdmin encountered an unexpected internal error") .asString()); service.exception(JsonExtractException.class, (ex, req, res) -> { res.status(BAD_REQUEST_400); res.body(ErrorResponder.builder() .statusCode(BAD_REQUEST_400) .type(INVALID_ARGUMENT) .message("JSON payload of the request is not valid") .cause(ex) .asString()); }); }