MCPcopy Index your code
hub / github.com/codeaashu/claude-code / logErrorImpl

Function logErrorImpl

src/utils/errorLogSink.ts:152–174  ·  view source on GitHub ↗

* Implementation for logError - writes error to debug log and file.

(error: Error)

Source from the content-addressed store, hash-verified

150 * Implementation for logError - writes error to debug log and file.
151 */
152function logErrorImpl(error: Error): void {
153 const errorStr = error.stack || error.message
154
155 // Enrich axios errors with request URL, status, and server message for debugging
156 let context = ''
157 if (axios.isAxiosError(error) && error.config?.url) {
158 const parts = [`url=${error.config.url}`]
159 if (error.response?.status !== undefined) {
160 parts.push(`status=${error.response.status}`)
161 }
162 const serverMessage = extractServerMessage(error.response?.data)
163 if (serverMessage) {
164 parts.push(`body=${serverMessage}`)
165 }
166 context = `[${parts.join(',')}] `
167 }
168
169 logForDebugging(`${error.name}: ${context}${errorStr}`, { level: 'error' })
170
171 appendToLog(getErrorsPath(), {
172 error: `${context}${errorStr}`,
173 })
174}
175
176/**
177 * Implementation for logMCPError - writes MCP error to debug log and file.

Callers

nothing calls this directly

Calls 5

extractServerMessageFunction · 0.85
logForDebuggingFunction · 0.85
appendToLogFunction · 0.85
getErrorsPathFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected