Skip to content

GatewayAuthenticationError

Namespace: Vercel.AI.Gateway

public sealed class GatewayAuthenticationError : GatewayError, ISerializable

Authentication failed.

Inheritance: object → Exception → AiSdkException → GatewayError

Implements: ISerializable

View source

GatewayAuthenticationError(string?, int, Exception?, string?)

Section titled “GatewayAuthenticationError(string?, int, Exception?, string?)”
public GatewayAuthenticationError(string? message = null, int statusCode = 401, Exception? cause = null, string? generationId = null)

Creates an authentication error. The default message is Authentication failed.

Parameters

Name Type Description
message string
statusCode int
cause Exception
generationId string

View source

public override string Type { get; }

Gateway error type.

Value: string

View source

CreateContextual(bool, bool, int, Exception?, string?)

Section titled “CreateContextual(bool, bool, int, Exception?, string?)”
public static GatewayAuthenticationError CreateContextual(bool apiKeyProvided, bool oidcTokenProvided, int statusCode = 401, Exception? cause = null, string? generationId = null)

Builds the message for an API key, an OIDC token, or missing credentials.

Parameters

Name Type Description
apiKeyProvided bool
oidcTokenProvided bool
statusCode int
cause Exception
generationId string

Returns: GatewayAuthenticationError

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