HttpError

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

Represents server errors.

Parameters

code

HTTP Status code

responseBody

Response body

exceptionMessage

Custom error message

Constructors

Link copied to clipboard
constructor(code: Int, responseBody: HttpErrorResponse?, exception: Throwable, humanReadableMessage: String, exceptionMessage: String)

Properties

Link copied to clipboard
val code: Int
Link copied to clipboard
open override val exception: Throwable

Raw exception that was thrown

Link copied to clipboard
open override val exceptionMessage: String
Link copied to clipboard
open override val humanReadableMessage: String

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

Link copied to clipboard

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>