Interface ErrorHandler<T extends Throwable>

Type Parameters:
T - type of throwable handled by this handler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ErrorHandler<T extends Throwable>
The routing error handler. Can be mapped to the error cause in HttpRouting.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handle(ServerRequest req, ServerResponse res, T throwable)
    Error handling consumer.
  • Method Details

    • handle

      void handle(ServerRequest req, ServerResponse res, T throwable)
      Error handling consumer. Do not throw an exception from an error handler, it would make this error handler invalid and the exception would be ignored.

      The response retains the status configured before the failure. The error handler is responsible for configuring or deliberately retaining an appropriate status before sending a replacement response.

      Parameters:
      req - the server request
      res - the server response
      throwable - the cause of the error