Ajv error fix (#2258)
* Fix ajv validation errors * Update error format
This commit is contained in:
parent
096bde44ee
commit
c93682f677
@ -41,9 +41,10 @@ class JsonSchemaAjv {
|
|||||||
|
|
||||||
validate(data) {
|
validate(data) {
|
||||||
if (this._validate(data)) { return; }
|
if (this._validate(data)) { return; }
|
||||||
const {errors} = this._validate(data);
|
const {errors} = this._validate;
|
||||||
const message = errors.map((e) => e.toString()).join('\n');
|
const error = new Error('Schema validation failed');
|
||||||
throw new Error(message);
|
error.data = JSON.parse(JSON.stringify(errors));
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user