UNPKG

@beignet/core

Version:

Core framework primitives for Beignet

24 lines 786 B
/** * Error thrown when Standard Schema validation fails. * Shared across client and server packages so `instanceof` checks work * regardless of which package threw the error. */ export class SchemaValidationError extends Error { /** * Normalized validation issues. */ issues; constructor(rawIssues) { const issues = rawIssues.map((i) => ({ path: i.path?.map((p) => (typeof p === "object" ? p.key : p)), message: i.message, })); const message = issues .map((i) => i.path?.length ? `${i.path.join(".")}: ${i.message}` : i.message) .join("; "); super(message); this.name = "SchemaValidationError"; this.issues = issues; } } //# sourceMappingURL=validation.js.map