ApiCallError
Namespace: Vercel.AI.Util
public class ApiCallError : AiSdkError, ISerializable, IErrorMarkersA failed provider HTTP call, including retry metadata and response headers.
Inheritance: object → Exception → AiSdkError
Implements: ISerializable, IErrorMarkers
Constructors
Section titled “Constructors”ApiCallError(string, string, object, int?, IReadOnlyDictionary<string, string>?, string?, Exception?, bool?, object?)
Section titled “ApiCallError(string, string, object, int?, IReadOnlyDictionary<string, string>?, string?, Exception?, bool?, object?)”public ApiCallError(string message, string url, object requestBodyValues, int? statusCode = null, IReadOnlyDictionary<string, string>? responseHeaders = null, string? responseBody = null, Exception? cause = null, bool? isRetryable = null, object? data = null)Creates the error.
Parameters
| Name | Type | Description |
|---|---|---|
message |
string | |
url |
string | |
requestBodyValues |
object | |
statusCode |
int? | |
responseHeaders |
IReadOnlyDictionary<string, string> | |
responseBody |
string | |
cause |
Exception | |
isRetryable |
bool? | |
data |
object |
Fields
Section titled “Fields”ErrorMarker
Section titled “ErrorMarker”public const string ErrorMarker = "vercel.ai.error.AI_APICallError"Marker for IsInstance(object).
Value: string
Properties
Section titled “Properties”public object? Data { get; }Parsed provider payload.
Value: object
IsRetryable
Section titled “IsRetryable”public bool IsRetryable { get; }Whether the call may be retried.
Value: bool
RequestBodyValues
Section titled “RequestBodyValues”public object RequestBodyValues { get; }Request body that was sent.
Value: object
ResponseBody
Section titled “ResponseBody”public string? ResponseBody { get; }Raw response body.
Value: string
ResponseHeaders
Section titled “ResponseHeaders”public IReadOnlyDictionary<string, string>? ResponseHeaders { get; }Response headers. Lookup is case-insensitive.
Value: IReadOnlyDictionary<string, string>
StatusCode
Section titled “StatusCode”public int? StatusCode { get; }HTTP status, when the provider responded.
Value: int?
public string Url { get; }Request URL.
Value: string
Methods
Section titled “Methods”GetHeader(string?)
Section titled “GetHeader(string?)”public string? GetHeader(string? name)Reads a response header, ignoring case.
Parameters
| Name | Type | Description |
|---|---|---|
name |
string |
Returns: string
IsInstance(object?)
Section titled “IsInstance(object?)”public static bool IsInstance(object? error)Returns whether <code class=“paramref”>error</code> carries this error’s marker.
Parameters
| Name | Type | Description |
|---|---|---|
error |
object |
Returns: bool
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product