Skip to content

Commit

Permalink
move callback outside of try / catch
Browse files Browse the repository at this point in the history
it's dangerous to callback inside try, because you may catch unexpected throws in callback.
  • Loading branch information
dominictarr committed Jun 12, 2011
1 parent ae5aec6 commit 6c6887a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/nconf/stores/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ File.prototype.load = function (callback) {

try {
self.store = self.format.parse(data.toString());
callback(null, self.store);
}
catch (ex) {
self.store = {};
callback(ex);
return callback(ex);
}
callback(null, self.store);

});
};

Expand Down

0 comments on commit 6c6887a

Please sign in to comment.