Interface ErrorExchange<A extends ExchangeContext>

Type Parameters:
A - the type of the exchange context
All Superinterfaces:
BaseExchange<A,Request,Response>, Exchange<A>
All Known Subinterfaces:
ErrorWebExchange<A>

public interface ErrorExchange<A extends ExchangeContext> extends Exchange<A>

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. It is handled in an ExchangeHandler used to format the actual response returned to the client.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Method Details

    • getError

      Throwable getError()

      Returns the error at the origin of the exchange.

      Returns:
      a throwable of type A
    • webSocket

      default Optional<? extends WebSocket<A,? extends WebSocketExchange<A>>> webSocket(String... subProtocols)

      Returns an empty optional since an error exchange does not support WebSocket upgrade.

      Specified by:
      webSocket in interface Exchange<A extends ExchangeContext>
      Parameters:
      subProtocols - a list of supported subprotocols negotiated during the handshake
      Returns:
      an empty optional
    • mapError

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

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

      Parameters:
      errorMapper - an error mapper
      Returns:
      a new error exchange