getRetryDelay (api/withRetry.ts)

gitingest_Gitlawb_openclaude · src/services/api/withRetry.ts · typescript · MIT
ai

Provides retry logic and error handling for API calls.

// Source: https://github.com/Gitlawb/openclaude | License: MIT | Copyright Anthropic PBC. All rights reserved
// Provided via justclaw.it.com; keep this notice with the code.
import { feature } from 'bun:bundle'
import type Anthropic from '@anthropic-ai/sdk'
import {
  APIConnectionError,
  APIError,
  APIUserAbortError,
} from '@anthropic-ai/sdk'
import type { QuerySource } from 'src/constants/querySource.js'
import type { SystemAPIErrorMessage } from 'src/types/message.js'
import {
  isExpectedSideTaskAbortReason,
  normalizeAbortReason,
} from 'src/utils/abortReasons.js'
import { isAwsCredentialsProviderError } from 'src/utils/aws.js'
import { logForDebugging } from 'src/utils/debug.js'
import { logError } from 'src/utils/log.js'
import { createSystemAPIErrorMessage } from 'src/utils/m

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key