MCPcopy
hub / github.com/di-sukharev/opencommit / getStatusCode

Function getStatusCode

src/utils/engineErrorHandler.ts:13–30  ·  view source on GitHub ↗

* Extracts HTTP status code from various error types

(error: unknown)

Source from the content-addressed store, hash-verified

11 * Extracts HTTP status code from various error types
12 */
13function getStatusCode(error: unknown): number | null {
14 // Direct status property (common in API SDKs)
15 if (typeof (error as any)?.status === 'number') {
16 return (error as any).status;
17 }
18
19 // Axios-style errors
20 if (axios.isAxiosError(error)) {
21 return error.response?.status ?? null;
22 }
23
24 // Response object with status
25 if (typeof (error as any)?.response?.status === 'number') {
26 return (error as any).response.status;
27 }
28
29 return null;
30}
31
32/**
33 * Extracts retry-after value from error headers (for rate limiting)

Callers 1

normalizeEngineErrorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…