MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / recordFinalError

Function recordFinalError

apps/desktop/src/main/ipc/generate.ts:324–341  ·  view source on GitHub ↗
(scope: string, runId: string, err: unknown)

Source from the content-addressed store, hash-verified

322 const providerContext = createProviderContextStore(50);
323
324 const recordFinalError = (scope: string, runId: string, err: unknown): void => {
325 if (db === null) return;
326 const code = err instanceof CodesignError ? (err.code as string) : 'PROVIDER_UPSTREAM_ERROR';
327 const stack = err instanceof Error ? err.stack : undefined;
328 const message = err instanceof Error ? err.message : String(err);
329 const context = providerContext.consume(runId);
330 recordDiagnosticEvent(db, {
331 level: 'error',
332 code,
333 scope,
334 runId,
335 fingerprint: computeFingerprint({ errorCode: code, stack, message }),
336 message,
337 stack,
338 transient: false,
339 ...(context !== undefined ? { context } : {}),
340 });
341 };
342
343 /** Adapter so `core` can log step events through the same scoped electron-log
344 * sink the IPC handler uses. Keeps a single timeline per generation in the

Callers 1

registerGenerateIpcFunction · 0.85

Calls 3

recordDiagnosticEventFunction · 0.90
computeFingerprintFunction · 0.90
consumeMethod · 0.80

Tested by

no test coverage detected