Ajv error fix (#2258)

* Fix ajv validation errors

* Update error format
This commit is contained in:
toasted-nutbread 2022-10-16 22:08:03 -04:00 committed by GitHub
parent 096bde44ee
commit c93682f677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,9 +41,10 @@ class JsonSchemaAjv {
validate(data) {
if (this._validate(data)) { return; }
const {errors} = this._validate(data);
const message = errors.map((e) => e.toString()).join('\n');
throw new Error(message);
const {errors} = this._validate;
const error = new Error('Schema validation failed');
error.data = JSON.parse(JSON.stringify(errors));
throw error;
}
}