spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / telemetry / hooks / batching / is-retriable / is-retriable.ts
15 lines · 605 BRaw
1import { STATUS_REQUEST_TIMEOUT } from './status-request-timeout'
2import { STATUS_SERVER_ERROR } from './status-server-error'
3import { STATUS_TOO_MANY_REQUESTS } from './status-too-many-requests'
4
5/**
6 * Whether an answer from the ingest is worth the one retry: a server error,
7 * a timeout or a rate limit; anything else it refused stays refused.
8 *
9 * @param status the HTTP status the ingest answered
10 * @returns true for 5xx, 408 and 429
11 */
12export const isRetriable = (status: number) =>
13 status >= STATUS_SERVER_ERROR ||
14 status === STATUS_REQUEST_TIMEOUT ||
15 status === STATUS_TOO_MANY_REQUESTS