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

Function logErrorImpl

src/utils/errorLogSink.ts:153–178  ·  view source on GitHub ↗

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

(error: Error)

Source from the content-addressed store, hash-verified

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

Callers 1

runSummaryFunction · 0.85

Calls 6

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

Tested by

no test coverage detected