Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

Commit

Permalink
Throw error when resolving references if reference data is not found (#2
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kmudrick authored and pkedy committed Jun 21, 2017
1 parent 60bac80 commit 32d841e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,13 @@ module.exports.resolveReference = function(obj, spec, references) {
var parent = null;

if (path) {
_.each(path, function(slug) {
_.each(path, function(slug, index) {
if (data != null) {
parent = data;
if (data[slug] === undefined) {
var iteree = path.slice(0, index+1).join('/')
throw new Error("Could not find " + iteree + " in " + ext);
}
data = data[slug];
}
});
Expand Down

0 comments on commit 32d841e

Please sign in to comment.