AiSdkError
Namespace: Vercel.AI.Util
public class AiSdkError : Exception, ISerializable, IErrorMarkersBase error for upstream AI SDK error types. Marker checks work without a shared assembly.
Inheritance: object → Exception
Implements: ISerializable, IErrorMarkers
Derived: NoSuchProviderReferenceError, SerializationError, ApiCallError, DecisionRefusalError, DecisionUnsupportedQuestionTypeError, DownloadError, InvalidArgumentError, InvalidToolInputError, NoSuchModelError, NoSuchToolError, RetryError, StreamProviderError, ToolCallRepairError
Constructors
Section titled “Constructors”AiSdkError(string?, string, Exception?)
Section titled “AiSdkError(string?, string, Exception?)”public AiSdkError(string? name, string message, Exception? cause = null)Creates an error with the upstream <code class=“paramref”>name</code> and <code class=“paramref”>message</code>.
Parameters
| Name | Type | Description |
|---|---|---|
name |
string | |
message |
string | |
cause |
Exception |
Fields
Section titled “Fields”Marker
Section titled “Marker”public const string Marker = "vercel.ai.error"Marker present on every AI SDK error.
Value: string
Properties
Section titled “Properties”public Exception? Cause { get; }Underlying cause, when one was supplied.
Value: Exception
ErrorName
Section titled “ErrorName”public string ErrorName { get; }Upstream error name, such as AI_APICallError.
Value: string
Methods
Section titled “Methods”HasMarker(object?, string?)
Section titled “HasMarker(object?, string?)”public static bool HasMarker(object? error, string? marker)Returns whether <code class=“paramref”>error</code> has <code class=“paramref”>marker</code> set to true.
Parameters
| Name | Type | Description |
|---|---|---|
error |
object | |
marker |
string |
Returns: bool
HasMarker(string)
Section titled “HasMarker(string)”public bool HasMarker(string marker)Returns whether <code class=“paramref”>marker</code> is set to true.
Parameters
| Name | Type | Description |
|---|---|---|
marker |
string |
Returns: bool
IsInstance(object?)
Section titled “IsInstance(object?)”public static bool IsInstance(object? error)Returns whether <code class=“paramref”>error</code> carries the base AI SDK marker.
Parameters
| Name | Type | Description |
|---|---|---|
error |
object |
Returns: bool
SetMarker(string, bool)
Section titled “SetMarker(string, bool)”protected void SetMarker(string marker, bool value)Records a marker used by String).
Parameters
| Name | Type | Description |
|---|---|---|
marker |
string | |
value |
bool |
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product