MCPcopy Create free account
hub / github.com/codeaashu/claude-code / categorizeRetryableAPIError

Function categorizeRetryableAPIError

src/services/api/errors.ts:1163–1182  ·  view source on GitHub ↗
(
  error: APIError,
)

Source from the content-addressed store, hash-verified

1161}
1162
1163export function categorizeRetryableAPIError(
1164 error: APIError,
1165): SDKAssistantMessageError {
1166 if (
1167 error.status === 529 ||
1168 error.message?.includes('"type":"overloaded_error"')
1169 ) {
1170 return 'rate_limit'
1171 }
1172 if (error.status === 429) {
1173 return 'rate_limit'
1174 }
1175 if (error.status === 401 || error.status === 403) {
1176 return 'authentication_failed'
1177 }
1178 if (error.status !== undefined && error.status >= 408) {
1179 return 'server_error'
1180 }
1181 return 'unknown'
1182}
1183
1184export function getErrorMessageIfRefusal(
1185 stopReason: BetaStopReason | null,

Callers 1

submitMessageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected