recover

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


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

Maps the encapsulated error response using the given function block if it corresponds to an ignored response.

Exceptions other than responses will be rethrown in a new RestResult.

Any thrown exception will be encapsulated in a new RestResult.

May return a new RestResult.

See also