suspendOnException

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

Author

skydoves (Jaewoong Eum)

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

Return

The original ApiResponse.

Parameters

onResult

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