Skip to content

Documentation / @agentick/shared / AdapterError

Class: AdapterError

Defined in: errors.ts:529

Error thrown by model adapters for provider-specific errors.

Example

typescript
throw new AdapterError('openai', 'No message in response', 'ADAPTER_RESPONSE');
throw new AdapterError('google', 'Rate limit exceeded', 'ADAPTER_RATE_LIMIT', { retryAfter: 60 });
throw new AdapterError('anthropic', 'Content blocked', 'ADAPTER_CONTENT_FILTER');

Extends

Constructors

Constructor

new AdapterError(provider, message, code?, details?, cause?): AdapterError

Defined in: errors.ts:536

Parameters

provider

string

message

string

code?

"ADAPTER_RESPONSE" | "ADAPTER_RATE_LIMIT" | "ADAPTER_AUTH" | "ADAPTER_CONTENT_FILTER" | "ADAPTER_CONTEXT_LENGTH"

details?

Record<string, unknown> = {}

cause?

Error

Returns

AdapterError

Overrides

AgentickError.constructor

Properties

cause?

readonly optional cause: Error

Defined in: errors.ts:108

Original error that caused this error

Inherited from

AgentickError.cause


code

readonly code: AgentickErrorCode

Defined in: errors.ts:102

Unique error code for programmatic handling

Inherited from

AgentickError.code


details

readonly details: Record<string, unknown>

Defined in: errors.ts:105

Additional error details

Inherited from

AgentickError.details


provider

readonly provider: string

Defined in: errors.ts:531

Provider name (openai, google, anthropic, etc.)


providerErrorCode?

readonly optional providerErrorCode: string

Defined in: errors.ts:534

Provider-specific error code

Methods

contentFiltered()

static contentFiltered(provider, reason?): AdapterError

Defined in: errors.ts:569

Create a content filter error

Parameters

provider

string

reason?

string

Returns

AdapterError


contextLength()

static contextLength(provider, maxTokens, requestedTokens?): AdapterError

Defined in: errors.ts:581

Create a context length error

Parameters

provider

string

maxTokens

number

requestedTokens?

number

Returns

AdapterError


fromJSON()

static fromJSON(json): AgentickError

Defined in: errors.ts:169

Create error from serialized format

Parameters

json

SerializedAgentickError

Returns

AgentickError

Inherited from

AgentickError.fromJSON


rateLimit()

static rateLimit(provider, retryAfter?): AdapterError

Defined in: errors.ts:557

Create a rate limit error

Parameters

provider

string

retryAfter?

number

Returns

AdapterError


toJSON()

toJSON(): SerializedAgentickError

Defined in: errors.ts:137

Serialize error for transport (JSON-safe)

Returns

SerializedAgentickError

Inherited from

AgentickError.toJSON

Released under the ISC License.