onError

fun onError(predicate: (Throwable) -> Boolean, responseProvider: suspend (Throwable, ServerRequest) -> ServerResponse)

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

Since

5.2

Parameters

predicate

the type of exception to filter

responseProvider

a function that creates a response


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

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

Since

5.2

Parameters

E

the type of exception to filter

responseProvider

a function that creates a response