ApiException
Namespace: Vercel.AI.Provider
public class ApiException : AiSdkException, ISerializableThe provider returned a non-success HTTP status after retries.
Inheritance: object → Exception → AiSdkException
Implements: ISerializable
Derived: AuthenticationException, BadRequestException, InternalServerException, NotFoundException, PermissionDeniedException, RateLimitException, UnprocessableEntityException
Constructors
Section titled “Constructors”ApiException(string, int, string?)
Section titled “ApiException(string, int, string?)”public ApiException(string message, int statusCode, string? responseBody)Creates an API exception.
Parameters
| Name | Type | Description |
|---|---|---|
message |
string | |
statusCode |
int | |
responseBody |
string |
ApiException(string, int, string?, Exception)
Section titled “ApiException(string, int, string?, Exception)”public ApiException(string message, int statusCode, string? responseBody, Exception innerException)Creates an API exception caused by <code class=“paramref”>innerException</code>.
Parameters
| Name | Type | Description |
|---|---|---|
message |
string | |
statusCode |
int | |
responseBody |
string | |
innerException |
Exception |
Properties
Section titled “Properties”ErrorData
Section titled “ErrorData”public object? ErrorData { get; init; }The provider error parsed from the response body, when the handler could parse it.
Maps to APICallError.data. Named ErrorData because Data already exists.
Value: object
IsRetryable
Section titled “IsRetryable”public bool IsRetryable { get; init; }True when the call can be retried. Defaults to 408, 429, and 500 and above.
Value: bool
RequestBodyValues
Section titled “RequestBodyValues”public object? RequestBodyValues { get; init; }Request body values the call was made with. Set by the response handlers.
Value: object
ResponseBody
Section titled “ResponseBody”public string? ResponseBody { get; }Raw response body, when the provider sent one.
Value: string
ResponseHeaders
Section titled “ResponseHeaders”public IReadOnlyDictionary<string, string>? ResponseHeaders { get; init; }Response headers, when the handler had them.
Value: IReadOnlyDictionary<string, string>
StatusCode
Section titled “StatusCode”public int StatusCode { get; }HTTP status code.
Value: int
public string? Url { get; init; }URL of the failed request. Set by the response handlers.
Value: string
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product