Permalink
Browse files

Pass a more robust error object to the callback

This is targeted primarily at when this module is being used in
conjunction with a module like node-sync
(https://github.com/0ctave/node-sync) that allows asynchronous
calls to be used with a synchronous-like syntax and behavior.
  • Loading branch information...
1 parent 3e25088 commit 1ca9389f8d09be1f612d124375f6f4e663bfe7a4 @2sidedfigure 2sidedfigure committed Dec 15, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/main.js
View
@@ -27,7 +27,8 @@ function setup_response_handler(req, callback) {
err = 1;
response = { error : { message : "Invalid JSON from stripe.com" } };
}
- callback(err, response)
+ err && (err = { statusCode: err, response: response });
+ callback(err, response);
});
});
}

0 comments on commit 1ca9389

Please sign in to comment.