BillTracker/utils
null 5ad3c4e18e refactor(errors): one canonical error handler + process resilience (Pillar B)
- formatError() now emits `code` (the field the client reads) and hides
  internals on any 5xx (missing status treated as 500). Single body shape
  everywhere: { error, message, code, field? }.
- The terminal error handler now delegates to formatError, so a thrown
  ApiError produces its real status + message + code (previously every
  error collapsed to a generic "Internal server error"). Only 5xx are
  logged/recorded; 4xx client errors no longer spam the error tracker.
  This unblocks the Express-5 `throw ApiError` route pattern.
- Resilience: added `uncaughtException` (record + exit for clean restart),
  enriched `unhandledRejection` (record, don't crash), and a SIGTERM/SIGINT
  graceful shutdown that drains connections, checkpoints the WAL, and
  closes the DB — verified: kill -TERM → "database closed cleanly" + exit.

check:server + typecheck:server clean; 232/232 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 14:33:38 -05:00
..
apiError.cts refactor(errors): one canonical error handler + process resilience (Pillar B) 2026-07-06 14:33:38 -05:00
dates.mts feat(server-ts): utils/dates → TypeScript (.mts); utils/ dir now TS (Phase 2) 2026-07-05 13:48:44 -05:00
money.mts style: apply Prettier across client + server (no behavior change) 2026-07-06 14:23:53 -05:00