From 6c6887a8500a9b2d66291e43628094c964301d91 Mon Sep 17 00:00:00 2001 From: Dominic Tarr Date: Sun, 12 Jun 2011 15:45:02 -0700 Subject: [PATCH] move callback outside of try / catch it's dangerous to callback inside try, because you may catch unexpected throws in callback. --- lib/nconf/stores/file.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/nconf/stores/file.js b/lib/nconf/stores/file.js index 45e2bddc..6d3aa0cf 100644 --- a/lib/nconf/stores/file.js +++ b/lib/nconf/stores/file.js @@ -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); + }); };