move callback outside of try / catch

it's dangerous to callback inside try, because you may catch unexpected throws in callback.
This commit is contained in:
Dominic Tarr 2011-06-12 15:45:02 -07:00
parent ae5aec6830
commit 6c6887a850

View file

@ -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);
});
};