Interface ErrorHandler<T extends Throwable>

Type Parameters:
T - Type of handled error.
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 the Routing.

Before invoking each matching handler, routing removes uncommitted entity headers: Content-Length, Transfer-Encoding, Trailer, Content-Range, Content-Type, Content-Encoding, Content-Language, Content-Location, Content-Disposition, Content-Digest, Content-MD5, Digest, Repr-Digest, ETag, Last-Modified, and Accept-Ranges. This also applies between handlers when forwarding with ServerRequest.next() or ServerRequest.next(Throwable). The handler sending a replacement entity must set its entity metadata. The reset itself preserves the status and other headers, including cookies, authentication challenges, and application headers. Committed headers are left unchanged; matching handlers are still invoked.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Error handling consumer.
  • Method Details

    • accept

      void accept(ServerRequest req, ServerResponse res, T ex)
      Error handling consumer.
      Parameters:
      req - the server request
      res - the server response
      ex - the cause of the error