Package se.fortnox.reactivewizard
Class ExceptionHandler
java.lang.Object
se.fortnox.reactivewizard.ExceptionHandler
Handles exceptions and writes errors to the response and the log.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetHeaderValue(Map.Entry<String, String> header) Override this to specify own logic to handle certain headers.org.reactivestreams.Publisher<Void>handleException(reactor.netty.http.server.HttpServerRequest request, reactor.netty.http.server.HttpServerResponse response, Throwable throwable) Handle exceptions from server requests.
-
Constructor Details
-
ExceptionHandler
@Inject public ExceptionHandler(com.fasterxml.jackson.databind.ObjectMapper mapper) -
ExceptionHandler
public ExceptionHandler()
-
-
Method Details
-
handleException
public org.reactivestreams.Publisher<Void> handleException(reactor.netty.http.server.HttpServerRequest request, reactor.netty.http.server.HttpServerResponse response, Throwable throwable) Handle exceptions from server requests.- Parameters:
request- The current requestresponse- The current responsethrowable- The exception that occured- Returns:
- success or error
-
getHeaderValue
Override this to specify own logic to handle certain headers. Typically redact sensitive stuff.- Parameters:
header- the header entry where the Map.Entry key is the header name and the Map.Entry value is the header value- Returns:
- the string that should be logged for this particular header in case of an Exception.
-