@adrper79-dot/errors
Typed error classes and utilities used across all Factory packages. No dependencies.Installation
API
FactoryError
Base class for all Factory errors. Extends Error with a machine-readable code and optional context bag.
Error subclasses
| Class | statusCode | Default code |
|---|---|---|
ValidationError | 400 | VALIDATION_ERROR |
AuthError | 401 | AUTH_ERROR |
ForbiddenError | 403 | FORBIDDEN |
NotFoundError | 404 | NOT_FOUND |
ConflictError | 409 | CONFLICT |
RateLimitError | 429 | RATE_LIMIT |
InternalError | 500 | INTERNAL_ERROR |
toErrorResponse(error)
Serializes any FactoryError into a JSON-safe response envelope: