handle

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

Dismisses the encapsulated exception and runs the given block if it matches the predicate.

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


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

Dismisses the encapsulated exception 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


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

Dismisses the encapsulated exception and runs the given block if it corresponds to an ignored exception type.

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