@nestjs-mod/common
Version:
A collection of utilities for unifying NestJS applications and modules
25 lines • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvModelValidationErrors = void 0;
/**
* Error thrown when environment model validation fails
* Contains both the validation errors and metadata info for debugging
*/
class EnvModelValidationErrors extends Error {
constructor(errors, info, message) {
const defaultMessage = Object.entries(info.validations)
.filter(([key, _value]) => errors.some((err) => err.property === key))
.map(([key, value]) => {
const extractors = value.propertyValueExtractors.map((e) => e.example.example).join(',');
const constraints = Object.keys(value.constraints || {}).join(',');
return `${extractors}-${constraints}`;
})
.join(';');
super(message || defaultMessage);
this.name = 'EnvModelValidationErrors';
this.errors = errors;
this.info = info;
}
}
exports.EnvModelValidationErrors = EnvModelValidationErrors;
//# sourceMappingURL=errors.js.map