Refactor silent debugging to happy path error handling

- Replaced instances of silentDebug with happy_path_error__with_fallback across multiple files to improve error logging and handling.
- Updated the utility function to provide clearer semantics for error handling when expected values are missing.
- Introduced a script to find potential silent failures in the codebase that may need to be addressed with the new error handling approach.
This commit is contained in:
Alex Newman
2025-12-09 15:09:44 -05:00
parent d957bff495
commit c3761a2204
25 changed files with 293 additions and 204 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import { join } from 'path';
import { homedir } from 'os';
import { existsSync, readFileSync } from 'fs';
import { silentDebug } from '../utils/silent-debug.js';
import { happy_path_error__with_fallback } from '../utils/silent-debug.js';
const SETTINGS_PATH = join(homedir(), '.claude-mem', 'settings.json');
@@ -25,7 +25,7 @@ export function loadEarlySetting(key: keyof EarlySettings, defaultValue: string)
if (fileValue !== undefined) return fileValue;
}
} catch (error) {
silentDebug('Failed to load settings file', { error, settingsPath: SETTINGS_PATH, key });
happy_path_error__with_fallback('Failed to load settings file', { error, settingsPath: SETTINGS_PATH, key });
}
return process.env[key] || defaultValue;