Module io.inverno.mod.http.server
Package io.inverno.mod.http.server
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>
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 Summary
Modifier and TypeMethodDescriptiongetError()Returns the error at the origin of the exchange.default ErrorExchange<A> Returns an error exchange consisting of the result of applying the given function to the error of the exchange.default Optional<? extends WebSocket<A, ? extends WebSocketExchange<A>>> Returns an empty optional since an error exchange does not support WebSocket upgrade.Methods inherited from interface io.inverno.mod.http.base.BaseExchange
context, getCancelCause, getProtocol, request, reset, reset, response
-
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:
webSocketin interfaceExchange<A extends ExchangeContext>- Parameters:
subprotocols- a list of supported subprotocols negotiated during the handshake- Returns:
- an empty optional
-
mapError
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
-