ClientException

@Serializable
open class ClientException(    val message: String? = null,     val cause: Throwable? = null,     val httpStatusCode: Int? = null,     val errorBody: ErrorBody? = null,     val errorString: String? = null,     val errorType: String? = null,     val httpURl: String? = null,     val code: String? = null,     val failureCount: Int? = null) : Throwable

ClientException class wraps exception and throwable across the code base. We encourage to use this class when dealing with Http Error response or throwing exceptions .

Parameters

httpStatusCode

the API code returned e.g 500, 400

errorBody

The error returned as a Json string.

message

the message related to this Exception.

cause

the cause related to this exception.

errorType

the string error type returned from API/ e.g INVALID_USERNAME_PASSWORD

Constructors

Link copied to clipboard
constructor(cause: Throwable? = null)
constructor(    message: String? = null,     cause: Throwable? = null,     httpStatusCode: Int? = null,     errorBody: ErrorBody? = null,     errorString: String? = null,     errorType: String? = null,     httpURl: String? = null,     code: String? = null,     failureCount: Int? = null)

Types

Link copied to clipboard
object Companion

class companion class

Properties

Link copied to clipboard
@Serializable(with = ThrowableSerializer::class)
open override val cause: Throwable? = null
Link copied to clipboard
val code: String? = null
Link copied to clipboard
val errorBody: ErrorBody? = null
Link copied to clipboard
val errorString: String? = null
Link copied to clipboard
val errorType: String? = null
Link copied to clipboard
val failureCount: Int? = null
Link copied to clipboard
val httpStatusCode: Int? = null
Link copied to clipboard
val httpURl: String? = null
Link copied to clipboard
open override val message: String? = null

Functions

Link copied to clipboard

provides a safe casting of throwable converts any throwable into a ClientException. Clients don't need to perform casting as its handled on the SDK level.

Link copied to clipboard
Link copied to clipboard
suspend fun Throwable.toClientException(failureCount: Int = 0): ClientException

provides a safe suspended casting of throwable converts any throwable into a ClientException. Clients don't need to perform casting as its handled on the SDK level.

Link copied to clipboard
fun ClientException.toNSError(): NSError

Converts a ClientException into an NSError object for better interop with Objective-C, Swift projects.

Link copied to clipboard
open override fun toString(): String

Custom implementation of the toString() function.