APICallError

class APICallError(message: String, val url: String, val requestBodyValues: JsonElement? = null, val statusCode: Int? = null, val responseHeaders: Map<String, String>? = null, val responseBody: String? = null, cause: Throwable? = null, val isRetryable: Boolean = statusCode == 408 || statusCode == 409 || statusCode == 429 || (statusCode ?: 0) >= 500) : AiSdkException(source)

Provider HTTP/API failure with normalized request and response details.

statusCode is the HTTP status when the failure came from a response; it is null for client-side transport failures or provider errors that do not expose a status. responseHeaders contains response headers exactly as the provider adapter captured them, or null when no response was received. isRetryable defaults to true for common transient statuses: 408, 409, 429, and 5xx. Providers may override it when the response body carries stronger retry semantics.

Since

0.3.0-beta01

Constructors

Link copied to clipboard
constructor(message: String, url: String, requestBodyValues: JsonElement? = null, statusCode: Int? = null, responseHeaders: Map<String, String>? = null, responseBody: String? = null, cause: Throwable? = null, isRetryable: Boolean = statusCode == 408 || statusCode == 409 || statusCode == 429 || (statusCode ?: 0) >= 500)

Properties

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard

Whether retry middleware should treat this failure as transient.

Link copied to clipboard
expect open val message: String?
Link copied to clipboard

JSON request body values when the provider adapter can expose them.

Link copied to clipboard

Raw response body text when the provider returned one.

Link copied to clipboard

Response headers captured from the provider, or null when unavailable.

Link copied to clipboard

HTTP status code for response-backed failures, or null for failures before a response exists.

Link copied to clipboard
val url: String

Fully resolved request URL.