domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
12 lines (11 loc) • 660 B
TypeScript
import { ConstraintError } from 'helpful-errors';
/**
* .what = common base for every schema-library validation error (zod, joi, yup, ...)
* .why = lets a single `instanceof HelpfulSchemaValidationError` recognize any schema
* validation failure. a new schema library extends this base — no consumer of the
* check (e.g. try-each hydration) needs to enumerate a closed list of libraries
* .note = extends ConstraintError — a schema validation failure means the caller supplied
* props that violate the declared shape (their fault), so exit code 2 + http 400 fit
*/
export declare class HelpfulSchemaValidationError extends ConstraintError {
}