onFailureSuspendAsError

inline suspend fun <T, E> Result<T>.onFailureSuspendAsError(crossinline action: suspend (errorModel: E?) -> Unit): Result<T>

Author

skydoves (Jaewoong Eum)

Since

1.0.1

Performs the given suspend action on the encapsulated custom error model E if this instance represents failure. The errorBody() of the HttpException will be deserialized to your custom error model E. The given suspend action can receive null if the error body is empty. Returns the original Result unchanged.

Parameters

action

Performs on the encapsulated value if this instance represents failure.