From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/ajv/lib/dot/ref.jst | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'node_modules/ajv/lib/dot/ref.jst') 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}}) { {{?}} {{??}} -- cgit v1.2.3