Error

sealed class Error : ApiResult<Nothing>

Uh oh this request hit a snag.

Inheritors

Types

Link copied to clipboard
data class GenericError(val exception: Throwable, val humanReadableMessage: String, val exceptionMessage: String) : ApiResult.Error

Represent other exceptions.

Link copied to clipboard
data class HttpError(    val code: Int,     val responseBody: HttpErrorResponse?,     val exception: Throwable,     val humanReadableMessage: String,     val exceptionMessage: String) : ApiResult.Error

Represents server errors.

Link copied to clipboard
data class SerializationError(val exception: Throwable, val humanReadableMessage: String, val exceptionMessage: String) : ApiResult.Error

Represent SerializationExceptions.

Properties

Link copied to clipboard
abstract val exception: Throwable

Raw exception that was thrown

Link copied to clipboard
abstract val exceptionMessage: String

Message from the exception

Link copied to clipboard

Human readable message for the error that can be displayed to users.

Functions

Link copied to clipboard
inline fun <T : Any> ApiResult<T>.getOrNull(): T?
Link copied to clipboard
inline fun <R : Any, T : Any> ApiResult<T>.map(transform: (value: T) -> R?): ApiResult<R>
Link copied to clipboard
inline fun <T : Any> ApiResult<T>.onError(block: (Throwable) -> Unit): ApiResult<T>
Link copied to clipboard
inline fun <T : Any> ApiResult<T>.onSuccess(block: (T) -> Unit): ApiResult<T>