UNPKG

domain-objects

Version:

A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.

26 lines (25 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HelpfulJoiValidationError = void 0; const HelpfulSchemaValidationError_1 = require("./HelpfulSchemaValidationError"); class HelpfulJoiValidationError extends HelpfulSchemaValidationError_1.HelpfulSchemaValidationError { constructor({ error, props, domainObject, }) { const details = error.details.map((detail) => ({ message: detail.message, path: detail.path.join('.'), type: detail.type, })); const message = ` Errors on ${Object.keys(details).length} properties were found while validating properties for domain object ${domainObject}.: ${JSON.stringify(details, null, 2)} Props Provided: ${JSON.stringify(props, null, 2)} `.trim(); super(message); this.details = details; this.props = props; this.domainObject = domainObject; } } exports.HelpfulJoiValidationError = HelpfulJoiValidationError; //# sourceMappingURL=HelpfulJoiValidationError.js.map