suspendOnFailure

inline suspend fun <T> ApiResponse<T>.suspendOnFailure(crossinline onResult: suspend ApiResponse.Failure<T>.() -> Unit): ApiResponse<T>

Author

skydoves (Jaewoong Eum)

A suspension function that would be executed for handling error responses if the request failed or get an exception.

Return

The original ApiResponse.

Parameters

onResult

The receiver function that receiving ApiResponse.Failure if the request failed or get an exception.