Skip to content
This repository was archived by the owner on Feb 25, 2023. It is now read-only.

Commit c93682f

Browse files
Ajv error fix (#2258)
* Fix ajv validation errors * Update error format
1 parent 096bde4 commit c93682f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dev/schema-validate.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ class JsonSchemaAjv {
4141

4242
validate(data) {
4343
if (this._validate(data)) { return; }
44-
const {errors} = this._validate(data);
45-
const message = errors.map((e) => e.toString()).join('\n');
46-
throw new Error(message);
44+
const {errors} = this._validate;
45+
const error = new Error('Schema validation failed');
46+
error.data = JSON.parse(JSON.stringify(errors));
47+
throw error;
4748
}
4849
}
4950

0 commit comments

Comments
 (0)