handle

inline fun <T> RestResult<T>.handle(predicate: (Throwable) -> Boolean, block: (Throwable) -> Unit): RestResult<T>(source)
inline fun <T> RestResult<T>.handle(vararg types: KClass<out Throwable>, block: (Throwable) -> Unit): RestResult<T>(source)


inline fun <T> RestResult<T>.handle(vararg responses: ErrorResponse, block: (ErrorResponseException) -> Unit): RestResult<T>(source)

Dismisses the encapsulated error response and runs the given block if it corresponds to an ignored response.

Any thrown exception will be encapsulated in a new RestResult.

Returns a new RestResult with the ignored exception, or itself if it didn't match.

See also