spring-framework / org.springframework.web.reactive.function.server / RouterFunctionDsl / onError

onError

fun onError(predicate: (Throwable) -> Boolean, responseProvider: (Throwable, ServerRequest) -> Mono<ServerResponse>): Unit

Filters all exceptions that match the predicate by applying the given response provider function.

Parameters

predicate - the type of exception to filter

responseProvider - a function that creates a response

Since
5.2

inline fun <reified E : Throwable> onError(noinline responseProvider: (Throwable, ServerRequest) -> Mono<ServerResponse>): Unit

Filters all exceptions that match the predicate by applying the given response provider function.

Parameters

E - the type of exception to filter

responseProvider - a function that creates a response

Since
5.2