feat(logging): Wave 3 - add comprehensive error serialization with stack traces

- Add error-utils module with serializeError and sanitizeError utilities
- Enhance IPC error handling to capture full error context including stack traces
- Add logError helper function for consistent error logging across the application
- Update console and file log formats to properly serialize error objects
- Replace all basic error logging in BIPUsersDAO with structured logError calls
- Add ErrorLike and SerializedError type interfaces for type safety

This improves debugging capability by preserving full error details in development
while sanitizing sensitive information in production logs.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
test
2026-03-08 16:10:23 +08:00
parent c4fff84848
commit fba2c73782
5 changed files with 399 additions and 21 deletions

View File

@@ -167,3 +167,22 @@ export function getErrorCode(error: unknown): string {
}
return 'UNKNOWN_ERROR'
}
/**
* Error-like interface for non-Error objects that have error properties
*/
export interface ErrorLike {
name: string
message: string
stack?: string
cause?: unknown
}
/**
* Serialized error object for logging
* Can contain additional properties from Error subclasses
*/
export interface SerializedError extends ErrorLike {
cause?: SerializedError | string
[key: string]: unknown
}