protected Object handleError(Req req, Resp resp, Throwable error, Customization custom) { // if the handler throws error -> process it for (int i = 0; ; i++) { resp.result(null); ErrorHandler handler = custom.findErrorHandlerByType(error); try { Object result = null; if (handler != null) { result = handler.handleError(req, resp, error); } return result != null ? result : defaultErrorHandling(req, error); } catch (Exception e) { if (i >= getMaxReThrowCount(req)) { return U.rte("Too many times an error was re-thrown by the error handler(s)!"); } error = e; } } }
void error(final Req req, final Throwable error, LogLevel logLevel) { try { logError(req, error, logLevel); Resp resp = req.response().code(500).result(null); Object result = Customization.of(req).errorHandler().handleError(req, resp, error); HttpUtils.resultOf(req, result); } catch (Exception e) { Log.error("An error occurred inside the error handler!", e); HttpUtils.resultToResponse(req, HttpUtils.getErrorInfo(req.response(), e)); } }
protected Object handleError(Req req, Resp resp, Throwable error, Customization custom) { // if the handler throws error -> process it for (int i = 0; ; i++) { resp.result(null); ErrorHandler handler = custom.findErrorHandlerByType(error); try { Object result = null; if (handler != null) { result = handler.handleError(req, resp, error); } return result != null ? result : defaultErrorHandling(req, error); } catch (Exception e) { if (i >= getMaxReThrowCount(req)) { return U.rte("Too many times an error was re-thrown by the error handler(s)!"); } error = e; } } }
void error(final Req req, final Throwable error, LogLevel logLevel) { try { logError(req, error, logLevel); Resp resp = req.response().code(500).result(null); Object result = Customization.of(req).errorHandler().handleError(req, resp, error); HttpUtils.resultOf(req, result); } catch (Exception e) { Log.error("An error occurred inside the error handler!", e); HttpUtils.resultToResponse(req, HttpUtils.getErrorInfo(req.response(), e)); } }