Interface ErrorExchange<A extends Throwable>

Type Parameters:
A - the error type
All Superinterfaces:
Exchange

public interface ErrorExchange<A extends Throwable> extends Exchange

Represents a failing server exchange.

The HTTP server creates a failing exchange when an exception is thrown during the normal processing of a server Exchange. They are handled in an ErrorExchangeHandler that formats the actual response returned to the client.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
Exchange
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the error at the origin of the exchange.
    default <T extends Throwable>
    ErrorExchange<T>
    mapError​(Function<? super A,​? extends T> errorMapper)
    Returns an error exchange consisting of the result of applying the given function to the error of the exchange.

    Methods inherited from interface io.inverno.mod.http.server.Exchange

    request, response
  • Method Details

    • getError

      A getError()

      Returns the error at the origin of the exchange.

      Returns:
      a throwable of type A
    • mapError

      default <T extends Throwable> ErrorExchange<T> mapError(Function<? super A,​? extends T> errorMapper)

      Returns an error exchange consisting of the result of applying the given function to the error of the exchange.

      Type Parameters:
      T - the error type of the new exchange
      Parameters:
      errorMapper - an error mapper
      Returns:
      a new error exchange