Skip to content

DownloadError

Namespace: Vercel.AI.Util

public sealed class DownloadError : AiSdkError, ISerializable, IErrorMarkers

Failure while downloading a URL.

Inheritance: object → Exception → AiSdkError

Implements: ISerializable, IErrorMarkers

View source

DownloadError(string, string, int?, string?, Exception?)

Section titled “DownloadError(string, string, int?, string?, Exception?)”
public DownloadError(string url, string message, int? statusCode = null, string? statusText = null, Exception? cause = null)

Creates a download error.

Parameters

Name Type Description
url string
message string
statusCode int?
statusText string
cause Exception

View source

public const string ErrorMarker = "vercel.ai.error.AI_DownloadError"

Marker for IsInstance(object).

Value: string

View source

public int? StatusCode { get; }

HTTP status, when the response was received.

Value: int?

View source

public string? StatusText { get; }

HTTP status text, when the response was received.

Value: string

View source

public string Url { get; }

URL that failed.

Value: string

View source

public static DownloadError FromCause(string url, Exception cause)

Builds the message used when the transport throws.

Parameters

Name Type Description
url string
cause Exception

Returns: DownloadError

View source

public static DownloadError FromStatus(string url, int statusCode, string statusText)

Builds the message used for a non-success HTTP response.

Parameters

Name Type Description
url string
statusCode int
statusText string

Returns: DownloadError

View source

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

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product