diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2022-10-16 22:08:03 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-16 22:08:03 -0400 | 
| commit | c93682f677725eb4690818e98a0ea80bd211386e (patch) | |
| tree | 5a7561d2a18fdb35b1b23a8c11f2a2bc884d890c | |
| parent | 096bde44eea85f1c0cc2cc6d37b27559b3404a7a (diff) | |
Ajv error fix (#2258)
* Fix ajv validation errors
* Update error format
| -rw-r--r-- | dev/schema-validate.js | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/dev/schema-validate.js b/dev/schema-validate.js index 1a69ca48..1b47be8b 100644 --- a/dev/schema-validate.js +++ b/dev/schema-validate.js @@ -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;      }  } |