AFException

class AFException(val message: String? = null, val isError: Boolean? = null, val detail: String? = null, val data: String? = null, val errors: List<String?>? = null, val httpCode: Int? = null) : Exception

Represents an exception that occurs during an API call.

This class is used to deserialize error responses from the API. It extends Throwable so it can be thrown and caught like a standard exception.

Constructors

Link copied to clipboard
constructor(message: String? = null, isError: Boolean? = null, detail: String? = null, data: String? = null, errors: List<String?>? = null, httpCode: Int? = null)

Creates an AFException with the given message.

constructor(message: String? = null, isError: Boolean? = null, detail: String? = null, data: String? = null, errors: List<String?>? = null, httpCode: Int? = null, cause: Throwable?)

Creates an AFException that carries the underlying cause, so consumers can classify the failure (offline, timeout, TLS, decode) from the original exception instead of pattern-matching on message text.

Properties

Link copied to clipboard
open override val cause: Throwable?

The failure this exception wraps, from either construction path: the cause parameter of the secondary constructor, or a later initCause(...) on platforms whose Throwable offers it. A class with a primary constructor cannot delegate to super(cause), so the constructor form is carried in a field and the standard chain is read as the fallback - without it, initCause would compile, throw nothing and be silently discarded.

Link copied to clipboard
val data: String?

Additional data related to the error.

Link copied to clipboard

Additional details about the error.

Link copied to clipboard

The backend's machine-readable code for this failure, when the error response carried one - for example PAYMENT_METHOD_UPDATE_FAILED from an ActivePerks write. Branch on it instead of parsing message; null when the server sent none or the failure never reached the server.

Link copied to clipboard

A list of error messages.

Link copied to clipboard

The HTTP status code of the failed response, when one was received.

Link copied to clipboard

A boolean flag indicating if an error occurred. Defaults to true.

Link copied to clipboard

What kind of failure this is, classified the same way on every platform. Use it to localize or customize the copy you show; the default message is already member-safe.

Link copied to clipboard
open override val message: String?

A message that is safe to show the member. When the server rejected the request with its own message (HTTP 4xx), that message is carried unchanged. For system failures - no connection, timeouts, TLS, server errors, unreadable responses - it is a short, member-friendly sentence chosen by kind; the raw diagnostic text is in technicalMessage, never here.

Link copied to clipboard

Diagnostic text for logs and support - the underlying engine error, the HTTP status line, or a snippet of an unreadable response body. Never show it to a member: it can name hosts, URLs and internals.