getOrThrow

fun <T> ApiResponse<T>.getOrThrow(): T

Author

skydoves (Jaewoong Eum)

Returns the encapsulated data if this instance represents ApiResponse.Success or throws the encapsulated Throwable exception if it is ApiResponse.Failure.Error or ApiResponse.Failure.Exception.

Return

The encapsulated data.

Throws

if it is ApiResponse.Failure.Error or the encapsulated Throwable exception if it is ApiResponse.Failure.Exception.exception