Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function errorWrapper(errorCallback, handler)
- {
- var wrappedFunc = function(err, value)
- {
- if (err)
- {
- errorCallback(err);
- return;
- }
- try
- {
- handler(value);
- }
- catch (ex)
- {
- errorCallback(ex);
- }
- };
- return wrappedFunc;
- };
- function errorHandler(err)
- {
- // Handle the error
- };
- redisClient.hget('some_hash', 'name', errorWrapper(errorHandler, function(value)
- {
- sys.puts("Calling inner func");
- sys.puts(value);
- }));
Add Comment
Please, Sign In to add comment