Skip to content

AnthropicErrorData

Namespace: Vercel.AI.Anthropic

public sealed class AnthropicErrorData

Parsed Anthropic error body. Extra fields such as details are dropped.

Inheritance: object

View source

AnthropicErrorData(bool, string?, string?, string?, string)

Section titled “AnthropicErrorData(bool, string?, string?, string?, string)”
public AnthropicErrorData(bool success, string? type, string? errorType, string? message, string rawValue)

Creates a parsed error.

Parameters

Name Type Description
success bool
type string
errorType string
message string
rawValue string

View source

public string? ErrorType { get; }

Error type, such as overloaded_error.

Value: string

View source

public string? Message { get; }

Error message.

Value: string

View source

public string RawValue { get; }

Original JSON.

Value: string

View source

public bool Success { get; }

True when the body matches { type: error, error: { type, message } }.

Value: bool

View source

public string? Type { get; }

Top-level type.

Value: string

View source

public static AnthropicErrorData Parse(string json)

Parses an error payload. A matching object succeeds even when extra properties are present.

Parameters

Name Type Description
json string

Returns: AnthropicErrorData

View source

public JsonObject? Value()

The validated value with only type and error.type/error.message.

Returns: JsonObject

View source

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