Skip to content

Commit

Permalink
Debug node handles objects without constructor property
Browse files Browse the repository at this point in the history
Fixes #933
  • Loading branch information
knolleary committed Jul 15, 2016
1 parent 92d5af7 commit 15b6f62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 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.
Expand Down Expand Up @@ -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+"]";
Expand Down

0 comments on commit 15b6f62

Please sign in to comment.