1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Debug node handles objects without constructor property

Fixes #933
This commit is contained in:
Nick O'Leary 2016-07-15 22:41:35 +01:00
parent 92d5af7446
commit 15b6f6268b

View File

@ -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 = [];
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+"]";