Description
Create a standardized error response formatter utility to ensure all Fastify error replies return a consistent JSON structure containing timestamp, error code, message, and request ID.
Context & Requirements
Consistent error structures improve developer experience for frontend integration (mergepay-web). Fastify's setErrorHandler can be leveraged to format unhandled exceptions and validation errors uniformly.
Acceptance Criteria
Implementation Guidance
- Likely files to touch:
src/index.ts or error handling middleware modules.
- Integrate with the request ID propagation feature already established in the codebase.
Testing & Validation
- Add unit or integration tests verifying error response payloads for invalid requests.
- Run
npm test.
Submission Guidelines
- Open a Pull Request referencing
Closes #<issue-number>.
- Adhere to TypeScript strict rules and existing codebase formatting standards.
Wave complexity: Trivial
Description
Create a standardized error response formatter utility to ensure all Fastify error replies return a consistent JSON structure containing timestamp, error code, message, and request ID.
Context & Requirements
Consistent error structures improve developer experience for frontend integration (
mergepay-web). Fastify'ssetErrorHandlercan be leveraged to format unhandled exceptions and validation errors uniformly.Acceptance Criteria
setErrorHandlerin the Fastify server configuration.Implementation Guidance
src/index.tsor error handling middleware modules.Testing & Validation
npm test.Submission Guidelines
Closes #<issue-number>.Wave complexity: Trivial