Overview
A typed, code-tagged error hierarchy used everywhere in the Nordcom Commerce monorepo.
Every error has a stable code (so it can be matched safely across boundaries) and
a help URL that points at user-facing documentation.
For the canonical reference, see the README on GitHub.
Why
Throwing strings or generic Error instances loses information at every hop. This
package gives the platform a shared vocabulary for failures:
- Stable codes like
API_UNKNOWN_SHOP_DOMAINsurvive serialization and can be matched by HTTP handlers, middleware, and tests. - Semantic subclasses (
NotFoundError,InvalidHandleError,TooManyRequestsError) let callers branch on the kind of failure without parsing strings. - HTTP-mapped
statusCodelets API routes turn any thrown error into the right response with a singleerror.statusCode ?? 500. - Self-documenting: every error exposes a
helpURL pointing athttps://${SERVICE_DOMAIN}/docs/errors/<code>/.
In this section
- Overview — this page
- API Reference — auto-generated from TypeScript source