From 15b6f6268b3e1fbbcbb3c42974732fff40f22dde Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 15 Jul 2016 22:41:35 +0100 Subject: [PATCH] Debug node handles objects without constructor property Fixes #933 --- nodes/core/core/58-debug.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nodes/core/core/58-debug.js b/nodes/core/core/58-debug.js index 491f49060..bf9b6610f 100644 --- a/nodes/core/core/58-debug.js +++ b/nodes/core/core/58-debug.js @@ -1,5 +1,5 @@ /** - * Copyright 2013 IBM Corp. + * Copyright 2013, 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,11 @@ module.exports = function(RED) { msg.msg = msg.msg.toString('hex'); } else if (msg.msg && typeof msg.msg === 'object') { var seen = []; - msg.format = msg.msg.constructor.name || "Object"; + try { + msg.format = msg.msg.constructor.name || "Object"; + } catch(err) { + msg.format = "Object"; + } var isArray = util.isArray(msg.msg); if (isArray) { msg.format = "array ["+msg.msg.length+"]";