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

Function logError

src/utils/log.ts:159–200  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

157})
158
159export function logError(error: unknown): void {
160 const err = toError(error)
161 if (feature('HARD_FAIL') && isHardFailMode()) {
162 // biome-ignore lint/suspicious/noConsole:: intentional crash output
163 console.error('[HARD FAIL] logError called with:', err.stack || err.message)
164 // eslint-disable-next-line custom-rules/no-process-exit
165 process.exit(1)
166 }
167 try {
168 // Check if error reporting should be disabled
169 if (
170 // Cloud providers (Bedrock/Vertex/Foundry) always disable features
171 isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
172 isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) ||
173 isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) ||
174 process.env.DISABLE_ERROR_REPORTING ||
175 isEssentialTrafficOnly()
176 ) {
177 return
178 }
179
180 const errorStr = err.stack || err.message
181
182 const errorInfo = {
183 error: errorStr,
184 timestamp: new Date().toISOString(),
185 }
186
187 // Always add to in-memory log (no dependencies needed)
188 addToInMemoryErrorLog(errorInfo)
189
190 // If sink not attached, queue the event
191 if (errorLogSink === null) {
192 errorQueue.push({ type: 'error', error: err })
193 return
194 }
195
196 errorLogSink.logError(err)
197 } catch {
198 // pass
199 }
200}
201
202export function getInMemoryErrors(): { error: string; timestamp: string }[] {
203 return [...inMemoryErrorLog]

Callers 15

persistBinaryContentFunction · 0.70
platform.tsFile · 0.70
fileHistoryTrackEditFunction · 0.70
fileHistoryMakeSnapshotFunction · 0.70
fileHistoryRewindFunction · 0.70
fileHistoryGetDiffStatsFunction · 0.70
fileHistoryHasAnyChangesFunction · 0.70
applySnapshotFunction · 0.70
computeDiffStatsForFileFunction · 0.70
restoreBackupFunction · 0.70
copyFileHistoryForResumeFunction · 0.70
agenticSessionSearchFunction · 0.70

Calls 5

isEnvTruthyFunction · 0.90
isEssentialTrafficOnlyFunction · 0.85
toErrorFunction · 0.70
addToInMemoryErrorLogFunction · 0.70
errorMethod · 0.45

Tested by

no test coverage detected