Skip to content

GatewayResponseError

Namespace: Vercel.AI.Gateway

public sealed class GatewayResponseError : GatewayError, ISerializable

The Gateway error body could not be read.

Inheritance: object → Exception → AiSdkException → GatewayError

Implements: ISerializable

View source

GatewayResponseError(string?, int, JsonElement?, string?, Exception?, string?, bool?)

Section titled “GatewayResponseError(string?, int, JsonElement?, string?, Exception?, string?, bool?)”
public GatewayResponseError(string? message = null, int statusCode = 502, JsonElement? response = null, string? validationError = null, Exception? cause = null, string? generationId = null, bool? isRetryable = null)

Creates a response error.

Parameters

Name Type Description
message string
statusCode int
response JsonElement?
validationError string
cause Exception
generationId string
isRetryable bool?

View source

public JsonElement? Response { get; }

Raw response body.

Value: JsonElement?

View source

public override string Type { get; }

Gateway error type.

Value: string

View source

public string? ValidationError { get; }

Why the body was rejected.

Value: string

View source

public static bool IsInstance(Exception? error)

True when <code class=“paramref”>error</code> is this error.

Parameters

Name Type Description
error Exception

Returns: bool

View source

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