Class DefaultErrorHandler

java.lang.Object
dev.voidframework.web.http.impl.DefaultErrorHandler
All Implemented Interfaces:
ErrorHandler

@BindClass public class DefaultErrorHandler extends Object implements ErrorHandler
Default implementation of ErrorHandler.
  • Constructor Details

    • DefaultErrorHandler

      @Inject public DefaultErrorHandler(com.typesafe.config.Config configuration, Router router)
      Build a new instance.
      Parameters:
      configuration - The application configuration
      router - The router
  • Method Details

    • onBadRequest

      public Result onBadRequest(Context context, HttpException.BadRequest badRequestException)
      Description copied from interface: ErrorHandler
      This method is called when the provided request is invalid.
      Specified by:
      onBadRequest in interface ErrorHandler
      Parameters:
      context - The current context
      badRequestException - The cause (OPTIONAL)
      Returns:
      A result
    • onNotFound

      public Result onNotFound(Context context, HttpException.NotFound notFoundException)
      Description copied from interface: ErrorHandler
      This method is called when no route has been found to satisfy the request.
      Specified by:
      onNotFound in interface ErrorHandler
      Parameters:
      context - The current context
      notFoundException - The cause (OPTIONAL)
      Returns:
      A result
    • onServerError

      public Result onServerError(Context context, Throwable throwable)
      Description copied from interface: ErrorHandler
      This method is called when an unexpected error occurs during the processing of the request.
      Specified by:
      onServerError in interface ErrorHandler
      Parameters:
      context - The current context
      throwable - The cause
      Returns:
      A result