java.lang.Object
io.jooby.DefaultErrorHandler
- All Implemented Interfaces:
ErrorHandler
Default error handler with content negotiation support and optionally mute log statement base on
status code or exception types.
- Since:
- 2.4.1
- Author:
- edgar
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(Context ctx, Throwable cause, StatusCode code) Produces an error response using the given exception and status code.mute
(StatusCode... statusCodes) Generate a log.debug call if any of the status code error occurs as exception.Generate a log.debug call if any of the exception types occurs.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jooby.ErrorHandler
then
-
Constructor Details
-
DefaultErrorHandler
public DefaultErrorHandler()
-
-
Method Details
-
mute
Generate a log.debug call if any of the status code error occurs as exception.- Parameters:
statusCodes
- Status codes to mute.- Returns:
- This error handler.
-
mute
Generate a log.debug call if any of the exception types occurs.- Parameters:
exceptionTypes
- Exception types to mute.- Returns:
- This error handler.
-
apply
@NonNull public void apply(@NonNull Context ctx, @NonNull Throwable cause, @NonNull StatusCode code) Description copied from interface:ErrorHandler
Produces an error response using the given exception and status code.- Specified by:
apply
in interfaceErrorHandler
- Parameters:
ctx
- Web context.cause
- Application error.code
- Status code.
-