SdkError

open class SdkError(val type: ResponseEventType, val code: Int, messages: Map<String, List<String>>)

Base error from which all other error classes are derived. This provides basic error information like the type, code, and list of messages.

Most of the time, there is not need to know the specific error. If the app wants to handle specific errors, check and cast it to one of the derived error types (e.g. ApiError).

Example:

     private fun fetchOrder(redemptionCode: String) {
FlyBuyCore.getInstance(appAuthId).orders.fetch(redemptionCode) { order, sdkError ->
if (null != sdkError) {
when (sdkError) {
is CommonError -> {
when (sdkError.errorType) {
CommonErrorType.NO_CONNECTION -> TODO()
CommonErrorType.UNKNOWN_ERROR -> TODO()
CommonErrorType.EXCEPTION -> TODO()
}
}
is OrderError -> {
when (sdkError.errorType) {
OrderErrorType.FAILED_TO_UPDATE_PUSH_DATA -> TODO()
}
}
is ApiError -> {
// Use `sdkError.code` to check http response code
}
else -> {
// Handle any other errors
}
}
} else {
// Success!
}
}
}

Inheritors

Constructors

Link copied to clipboard
constructor(type: ResponseEventType, code: Int, messages: Map<String, List<String>>)

Properties

Link copied to clipboard
val code: Int
Link copied to clipboard

Functions

Link copied to clipboard
open fun description(): String
Link copied to clipboard
open fun userError(): String