Error Model
Error architecture
Section titled “Error architecture”- Error names are centralized in
backend/src/Shared/Errors.ts. - Errors are tagged by layer (
domain,application,infrastructure,presentation,shared). - Middleware maps error names to HTTP status and stable JSON payload.
Response shape
Section titled “Response shape”{ "code": "VALIDATION_FAILED", "message": "Request validation failed", "error": "walletId is required", "errors": [{ "path": "walletId", "message": "walletId is required" }]}Common mappings
Section titled “Common mappings”- 400: invalid payload, missing fields, invalid identifiers.
- 401: unauthenticated or invalid token.
- 403: permission/ownership violations.
- 404: missing resource.
- 409: unique/constraint conflicts.
- 422: validation failures.
- 500+: internal/infrastructure/provider failures.
Traceability
Section titled “Traceability”- Error definitions and defaults:
backend/src/Shared/Errors.ts. - Serialization and status mapping:
backend/src/Presentation/Middlewares/errorsMiddleware.ts.