Skip to content

ProviderError

Defined in: core/src/errors.ts:117

  • Error
new ProviderError(
provider,
kind,
message,
opts?
): ProviderError;

Defined in: core/src/errors.ts:134

Parameter Type
provider string
kind ErrorKind
message string
opts { body?: string; cause?: unknown; code?: string; resetAtMs?: number; retryAfterMs?: number; shouldRetry?: boolean; status?: number; window?: RateLimitWindow; }
opts.body? string
opts.cause? unknown
opts.code? string
opts.resetAtMs? number
opts.retryAfterMs? number
opts.shouldRetry? boolean
opts.status? number
opts.window? RateLimitWindow

ProviderError

Error.constructor
readonly optional body?: string;

Defined in: core/src/errors.ts:132

The provider’s own response body, truncated. It carries the actual reason, otherwise lost behind “400 status code (no body)”.


optional cause?: unknown;

Defined in: node_modules/.bun/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Error.cause

readonly optional code?: string;

Defined in: core/src/errors.ts:121


readonly kind: ErrorKind;

Defined in: core/src/errors.ts:119


message: string;

Defined in: node_modules/.bun/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Error.message

name: string;

Defined in: node_modules/.bun/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Error.name

readonly provider: string;

Defined in: core/src/errors.ts:118


readonly optional resetAtMs?: number;

Defined in: core/src/errors.ts:126

Absolute reset of the binding limit. Can be days beyond Retry-After.


readonly optional retryAfterMs?: number;

Defined in: core/src/errors.ts:124

Honoured when the provider said how long to wait (Retry-After, or Gemini’s RetryInfo.retryDelay).


readonly optional shouldRetry?: boolean;

Defined in: core/src/errors.ts:129

Explicit server directive (x-should-retry), overriding default classification.


optional stack?: string;

Defined in: node_modules/.bun/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Error.stack

readonly optional status?: number;

Defined in: core/src/errors.ts:120


readonly optional window?: RateLimitWindow;

Defined in: core/src/errors.ts:127

get isBackupEligible(): boolean;

Defined in: core/src/errors.ts:167

boolean


get isTransient(): boolean;

Defined in: core/src/errors.ts:162

boolean

static from(provider, err): ProviderError;

Defined in: core/src/errors.ts:173

Wrap anything thrown into a classified ProviderError. Already-wrapped errors pass through untouched, so classification happens exactly once.

Parameter Type
provider string
err unknown

ProviderError