Skip to content

Commit

Permalink
Returning null as opposed to throwing for undefined getters
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Aug 2, 2010
1 parent 7af0a0e commit 3421d4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ Model = this.Model = Class({
var parts = path.split('.'), doc = this.__doc;
for (var i = 0, l = parts.length; i < l; i++){
doc = doc[parts[i]];
if (typeof doc == 'undefined') throw new Error('Path ' + path + ' is undefined');
if (typeof doc == 'undefined'){
return null;
}
}
return doc;
},
Expand Down

0 comments on commit 3421d4f

Please sign in to comment.