Permalink
Browse files

Tiny cleanup

  • Loading branch information...
1 parent 2cf64d0 commit d13df73ca1f0969da7396ca6e64eefc683f501ca @mattrobenolt committed Sep 13, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/snsclient.js
View
7 lib/snsclient.js
@@ -113,11 +113,12 @@ function SNSClient(opts, cb) {
chunks.push(chunk);
});
req.on('end', function() {
+ var message;
try {
- var message = JSON.parse(chunks.join(''));
+ message = JSON.parse(chunks.join(''));
} catch(e) {
// catch a JSON parsing error
- return;
+ return cb(new Error('Error parsing JSON'));
}
validateRequest(opts, message, function(err){
if(err) return;
@@ -132,7 +133,7 @@ function SNSClient(opts, cb) {
// end the request always before doing anything with the request.
// There isn't any reason to let it hang.
res.end();
- }
+ };
}
module.exports = SNSClient;

0 comments on commit d13df73

Please sign in to comment.