Skip to content
Browse files

Merge branch 'master' of https://github.com/EqualMedia/node-amqp into…

… json_error
  • Loading branch information...
2 parents e25a980 + 9a05b7e commit 5552e9b16ed9a12c273cf6c69c906f3e46479755 @postwait postwait committed Nov 21, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 amqp.js
View
8 amqp.js
@@ -1501,7 +1501,13 @@ Queue.prototype.subscribe = function (/* options, messageListener */) {
m.addListener('end', function () {
var json, deliveryInfo = {}, msgProperties = classes[60].fields;
if (isJSON) {
- json = JSON.parse(b);
+ try {
+ json = JSON.parse(b);
+ } catch (e) {
+ json = null;
+ deliveryInfo.parseError = e;
+ deliveryInfo.rawData = b;
+ }
} else {
json = { data: b, contentType: m.contentType };
}

0 comments on commit 5552e9b

Please sign in to comment.
Something went wrong with that request. Please try again.