diff --git a/amqp.js b/amqp.js index bb1fe9b..d12ae3b 100644 --- a/amqp.js +++ b/amqp.js @@ -1492,7 +1492,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 }; }