Class ErrorExceptionHandler<T extends Throwable>

java.lang.Object
io.micronaut.http.server.exceptions.ErrorExceptionHandler<T>
Type Parameters:
T - The throwable
All Implemented Interfaces:
ExceptionHandler<T,io.micronaut.http.HttpResponse<?>>
Direct Known Subclasses:
ConversionErrorHandler, UnsatisfiedArgumentHandler, UnsatisfiedRouteHandler, URISyntaxHandler

public abstract class ErrorExceptionHandler<T extends Throwable> extends Object implements ExceptionHandler<T,io.micronaut.http.HttpResponse<?>>
An abstract class to handle exceptions with an Error and responding a Bad Request HTTP Response via the ErrorResponseProcessor API.
Since:
4.6.0
  • Field Details

  • Constructor Details

    • ErrorExceptionHandler

      protected ErrorExceptionHandler(ErrorResponseProcessor<?> responseProcessor)
      Constructor.
      Parameters:
      responseProcessor - Error Response Processor
  • Method Details

    • handle

      public io.micronaut.http.HttpResponse<?> handle(io.micronaut.http.HttpRequest request, T exception)
      Description copied from interface: ExceptionHandler
      Handles an exception and returns the result.
      Specified by:
      handle in interface ExceptionHandler<T extends Throwable,io.micronaut.http.HttpResponse<?>>
      Parameters:
      request - The request
      exception - The exception type
      Returns:
      The result
    • error

      @NonNull protected abstract @NonNull Error error(T exception)