recover

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

Maps the encapsulated exception using the given block if it corresponds to the predicate.

Any thrown exception will be encapsulated in a new RestResult.

See also


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

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

Any thrown exception will be encapsulated in a new RestResult.

See also


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

Maps the encapsulated exception using the given block if it corresponds to an ignored exception type.

Any thrown exception will be encapsulated in a new RestResult.

See also