Skip to content
1 min read · 138 words

Function: anthropicErrorHeaders() ​

ts
function anthropicErrorHeaders(err: unknown): Headers | undefined;

Defined in: src/batteries/llm/anthropic_messages/error_translation.ts:82

The response headers of a real SDK HTTP error, or undefined for anything else.

Parameters ​

ParameterTypeDescription
errunknownThe thrown value.

Returns ​

Headers | undefined

The error's Headers, or undefined when it is not an SDK HTTP error.

Remarks ​

The Retry-After header is read on the retry path (adapter.ts and count_tokens.ts), and BOTH sites previously guarded with isInstanceOf(err, 'APIError', APIError) against the inlined copy — so issue #46 silently disabled Retry-After honouring as well as retry classification. Exporting the structural check here keeps ONE identity-free definition of "is this an SDK HTTP error" and lets those callers stop importing @anthropic-ai/sdk/core/error (which is what inlined the second class identity in the first place).