- All Known Implementing Classes:
DefaultErrorHandler
public interface ErrorHandler
Catch and encode application errors.
- Since:
- 2.0.0
- Author:
- edgar
-
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(Context ctx, Throwable cause, StatusCode code) Produces an error response using the given exception and status code.static DefaultErrorHandler
create()
Creates a default error handler.static String
errorMessage
(Context ctx, StatusCode statusCode) Build a line error message that describe the current web context and the status code.default ErrorHandler
then
(ErrorHandler next) Chain this error handler with next and produces a new error handler.
-
Method Details
-
apply
Produces an error response using the given exception and status code.- Parameters:
ctx
- Web context.cause
- Application error.code
- Status code.
-
then
Chain this error handler with next and produces a new error handler.- Parameters:
next
- Next error handler.- Returns:
- A new error handler.
-
errorMessage
Build a line error message that describe the current web context and the status code.GET /path Status-Code Status-Reason
- Parameters:
ctx
- Web context.statusCode
- Status code.- Returns:
- Single line message.
-
create
Creates a default error handler.- Returns:
- Default error handler.
-