Module io.jooby
Package io.jooby

Class DefaultErrorHandler

java.lang.Object
io.jooby.DefaultErrorHandler
All Implemented Interfaces:
ErrorHandler

public class DefaultErrorHandler extends Object implements 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 Details

    • DefaultErrorHandler

      public DefaultErrorHandler()
  • Method Details

    • mute

      @NonNull public DefaultErrorHandler mute(@NonNull StatusCode... statusCodes)
      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

      @NonNull public DefaultErrorHandler mute(@NonNull Class<? extends Exception>... exceptionTypes)
      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 interface ErrorHandler
      Parameters:
      ctx - Web context.
      cause - Application error.
      code - Status code.