Class ExceptionHandler

java.lang.Object
se.fortnox.reactivewizard.ExceptionHandler

public class ExceptionHandler extends Object
Handles exceptions and writes errors to the response and the log.
  • 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 request
      response - The current response
      throwable - The exception that occured
      Returns:
      success or error
    • getHeaderValue

      protected String getHeaderValue(Map.Entry<String,String> header)
      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.