Summary
routing handlers format errors ad hoc, so clients get inconsistent shapes and status codes. Introduce a typed domain-error taxonomy and route everything through one error middleware.
Why this matters
Inconsistent errors are hard to consume and hide bugs. A typed taxonomy + one mapping point makes responses predictable and testable.
Requirements
- Define a domain-error type with a
code, HTTP status, and safe message.
- Route all routing errors through a single error middleware producing
{ code, message, requestId }.
- Never leak internal details or stack traces to clients.
- Remove the per-handler ad-hoc error formatting.
Technical guidance
- Map each domain error to exactly one status code in one place.
- Preserve the requestId for correlation.
Edge cases — each must have a test
Acceptance criteria
Out of scope
- Localized error messages
- Client SDK error types
Rewards
Part of the GrantFox OSS / Official Campaign (FWC26) — this task may be rewarded. PR quality is assessed by AI: depth, correctness under edge cases, meaningful tests, and clean design are what earn the reward. Shallow changes (typos, formatting, trivial docs) do not qualify.
Summary
routing handlers format errors ad hoc, so clients get inconsistent shapes and status codes. Introduce a typed domain-error taxonomy and route everything through one error middleware.
Why this matters
Inconsistent errors are hard to consume and hide bugs. A typed taxonomy + one mapping point makes responses predictable and testable.
Requirements
code, HTTP status, and safe message.{ code, message, requestId }.Technical guidance
Edge cases — each must have a test
Acceptance criteria
npm run lint,npm test, andnpm run buildall pass locallyCloses #<issue>Out of scope
Rewards
Part of the GrantFox OSS / Official Campaign (FWC26) — this task may be rewarded. PR quality is assessed by AI: depth, correctness under edge cases, meaningful tests, and clean design are what earn the reward. Shallow changes (typos, formatting, trivial docs) do not qualify.