Rest Result
Encapsulates a successful outcome or a failure.
Failures can be dismissed as long as the value isn't retrieved.
See also
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T> RestResult<T>.handle(vararg types: KClass<out Throwable>, block: (Throwable) -> Unit): RestResult<T>
inline fun <T> RestResult<T>.handle(predicate: (Throwable) -> Boolean, block: (Throwable) -> Unit): RestResult<T>
inline fun <T> RestResult<T>.handle(vararg responses: ErrorResponse, block: (ErrorResponseException) -> Unit): RestResult<T>
Dismisses the encapsulated error response and runs the given block if it corresponds to an ignored response.
Link copied to clipboard
Dismisses the encapsulated exception if it corresponds to an ignored exception.
Dismisses the encapsulated error response if it corresponds to an ignored response.
Dismisses the encapsulated exception if it corresponds to an predicate.
Link copied to clipboard
Runs the given block if the result is an error response.
inline fun <T> RestResult<T>.onErrorResponse(error: ErrorResponse, block: (ErrorResponseException) -> Unit): RestResult<T>
Runs the given block if the result is the specified error response.
Link copied to clipboard
inline fun <T> RestResult<T>.onErrorResponseException(block: (ErrorResponseException) -> Unit): RestResult<T>
Runs the given block if the result is an ErrorResponseException.
Link copied to clipboard
inline fun <T : R, R> RestResult<T>.recover(vararg types: KClass<out Throwable>, block: (Throwable) -> R): RestResult<R>
inline fun <T : R, R> RestResult<T>.recover(predicate: (Throwable) -> Boolean, block: (Throwable) -> R): RestResult<R>
inline fun <T : R, R> RestResult<T>.recover(vararg responses: ErrorResponse, block: (ErrorResponseException) -> R): RestResult<R>
Maps the encapsulated error response using the given function block if it corresponds to an ignored response.