Interface ThrowableHttpMapper

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@NullMarked @FunctionalInterface public interface ThrowableHttpMapper
Maps a Throwable (a Try.Failure cause) to an HTTP ServerResponse.

Supplied to WebfluxFun.fromTry(Mono, ThrowableHttpMapper) so a failed Try is rendered with a status and body the application controls (for example translating known exception types to 4xx and unknown ones to 500).

  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse>
    Renders the given cause as an HTTP response.
  • Method Details

    • apply

      reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse> apply(Throwable cause)
      Renders the given cause as an HTTP response.
      Parameters:
      cause - the failure cause
      Returns:
      the response to send for this failure