onFailure

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

Author

skydoves (Jaewoong Eum)

A 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.