MCPcopy
hub / github.com/claude-code-best/claude-code / describeAxiosError

Function describeAxiosError

src/bridge/debugUtils.ts:60–82  ·  view source on GitHub ↗
(err: unknown)

Source from the content-addressed store, hash-verified

58 * since axios's default message only includes the status code.
59 */
60export function describeAxiosError(err: unknown): string {
61 const msg = errorMessage(err)
62 if (err && typeof err === 'object' && 'response' in err) {
63 const response = (err as { response?: { data?: unknown } }).response
64 if (response?.data && typeof response.data === 'object') {
65 const data = response.data as Record<string, unknown>
66 const detail =
67 typeof data.message === 'string'
68 ? data.message
69 : typeof data.error === 'object' &&
70 data.error &&
71 'message' in data.error &&
72 typeof (data.error as Record<string, unknown>).message ===
73 'string'
74 ? (data.error as Record<string, unknown>).message
75 : undefined
76 if (detail) {
77 return `${msg}: ${detail}`
78 }
79 }
80 }
81 return msg
82}
83
84/**
85 * Extract the HTTP status code from an axios error, if present.

Callers 2

startWorkPollLoopFunction · 0.85
runBridgeLoopFunction · 0.85

Calls 1

errorMessageFunction · 0.50

Tested by

no test coverage detected