diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/ajv/lib/dot/ref.jst | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/ajv/lib/dot/ref.jst')
-rw-r--r-- | node_modules/ajv/lib/dot/ref.jst | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/node_modules/ajv/lib/dot/ref.jst b/node_modules/ajv/lib/dot/ref.jst index e8cdc4435..4a0889686 100644 --- a/node_modules/ajv/lib/dot/ref.jst +++ b/node_modules/ajv/lib/dot/ref.jst @@ -25,21 +25,16 @@ {{??}} {{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }} {{? $refVal === undefined }} - {{ var $message = 'can\'t resolve reference ' + $schema + ' from id ' + it.baseId; }} + {{ var $message = it.MissingRefError.message(it.baseId, $schema); }} {{? it.opts.missingRefs == 'fail' }} - {{ console.log($message); }} + {{ console.error($message); }} {{# def.error:'$ref' }} {{? $breakOnError }} if (false) { {{?}} {{?? it.opts.missingRefs == 'ignore' }} - {{ console.log($message); }} + {{ console.warn($message); }} {{? $breakOnError }} if (true) { {{?}} {{??}} - {{ - var $error = new Error($message); - $error.missingRef = it.resolve.url(it.baseId, $schema); - $error.missingSchema = it.resolve.normalizeId(it.resolve.fullPath($error.missingRef)); - throw $error; - }} + {{ throw new it.MissingRefError(it.baseId, $schema, $message); }} {{?}} {{?? $refVal.inline }} {{# def.setupNextLevel }} @@ -68,12 +63,16 @@ {{? $async }} {{ if (!it.async) throw new Error('async schema referenced by sync schema'); }} - try { {{? $breakOnError }}var {{=$valid}} ={{?}} {{=it.yieldAwait}} {{=__callValidate}}; } - catch (e) { + {{? $breakOnError }} var {{=$valid}}; {{?}} + try { + {{=it.yieldAwait}} {{=__callValidate}}; + {{? $breakOnError }} {{=$valid}} = true; {{?}} + } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; + {{? $breakOnError }} {{=$valid}} = false; {{?}} } {{? $breakOnError }} if ({{=$valid}}) { {{?}} {{??}} |