Skip to content

Instantly share code, notes, and snippets.

@fengmk2
Created December 27, 2011 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fengmk2/1523075 to your computer and use it in GitHub Desktop.
Save fengmk2/1523075 to your computer and use it in GitHub Desktop.
Find bug in code
Foo.prototype.get = function(key, callback) {
db.get(key, function(err, data) {
if (err) return callback(err);
try {
callback(null, JSON.parse(data.toString()));
} catch(e) {
callback(e);
}
});
};
@JacksonTian
Copy link

这个callback自身的异常,应该由自己来处理吧。不该放到外面来处理的吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment