MCPcopy Create free account
hub / github.com/Noumena-Network/code / categorizeRetryableAPIError

Function categorizeRetryableAPIError

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

Source from the content-addressed store, hash-verified

1216}
1217
1218export function categorizeRetryableAPIError(
1219 error: APIError,
1220): SDKAssistantMessageError {
1221 if (
1222 error.status === 529 ||
1223 error.message?.includes('"type":"overloaded_error"')
1224 ) {
1225 return 'rate_limit'
1226 }
1227 if (error.status === 429) {
1228 return 'rate_limit'
1229 }
1230 if (error.status === 401 || error.status === 403) {
1231 return 'authentication_failed'
1232 }
1233 if (error.status !== undefined && error.status >= 408) {
1234 return 'server_error'
1235 }
1236 return 'unknown'
1237}
1238
1239export function getErrorMessageIfRefusal(
1240 stopReason: BetaStopReason | null,

Callers 1

submitMessageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected