Created
December 27, 2011 08:44
-
-
Save fengmk2/1523075 to your computer and use it in GitHub Desktop.
Find bug in code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这个callback自身的异常,应该由自己来处理吧。不该放到外面来处理的吧