From 0a850f984b929daa65c52dc29fec2ac046ed3b1e Mon Sep 17 00:00:00 2001 From: Lleonard Subirana Date: Tue, 14 Jan 2020 09:11:41 +0100 Subject: [PATCH] Fixed missing stack when exception is thrown Signed-off-by: Lleonard Subirana --- src/paho-mqtt.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/paho-mqtt.js b/src/paho-mqtt.js index d8c78cb..2440ad4 100644 --- a/src/paho-mqtt.js +++ b/src/paho-mqtt.js @@ -1260,7 +1260,7 @@ function onMessageArrived(message) { this.receiveBuffer = byteArray.subarray(offset); } } catch (error) { - var errorStack = ((error.hasOwnProperty("stack") == "undefined") ? error.stack.toString() : "No Error Stack Available"); + var errorStack = ((error.hasOwnProperty("stack") == "undefined") ? "No Error Stack Available" : error.stack.toString()); this._disconnected(ERROR.INTERNAL_ERROR.code , format(ERROR.INTERNAL_ERROR, [error.message,errorStack])); return; } @@ -1449,7 +1449,7 @@ function onMessageArrived(message) { this._disconnected(ERROR.INVALID_MQTT_MESSAGE_TYPE.code , format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type])); } } catch (error) { - var errorStack = ((error.hasOwnProperty("stack") == "undefined") ? error.stack.toString() : "No Error Stack Available"); + var errorStack = ((error.hasOwnProperty("stack") == "undefined") ? "No Error Stack Available" : error.stack.toString()); this._disconnected(ERROR.INTERNAL_ERROR.code , format(ERROR.INTERNAL_ERROR, [error.message,errorStack])); return; }