Normalize error handling
Introduce a base error class and a central handler to replace scattered, inconsistent catch blocks. Updates all API responses to use the unified pattern.
Preview
Copy prompt
The error handling across this codebase is inconsistent — some functions throw, some return error objects, and some silently swallow failures: [Paste code]. Introduce a unified error handling strategy by defining a typed base error class with a code and message, creating a central handler responsible for logging and formatting errors consistently, and updating every catch block and API error response to use the new pattern.
More
Refactoring
Prompts
