@amirmarmul/waba-common
Version:

20 lines (19 loc) • 554 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidationError = void 0;
const AppError_1 = require("../../core/errors/AppError");
class ValidationError extends AppError_1.AppError {
errors;
constructor(errors) {
super('Unprocessable Content', 422);
this.errors = errors;
}
static with(error) {
return new ValidationError([error]);
}
serializeErrors() {
return this.errors;
}
}
exports.ValidationError = ValidationError;
exports.default = ValidationError;