mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add node.error handling to core nodes
This commit is contained in:
@@ -75,7 +75,7 @@ module.exports = function(RED) {
|
||||
msg.payload = ou;
|
||||
node.send(msg);
|
||||
}
|
||||
catch(e) { node.error(e); }
|
||||
catch(e) { node.error(e,msg); }
|
||||
}
|
||||
else if (typeof msg.payload == "string") { // convert CSV string to object
|
||||
try {
|
||||
@@ -160,7 +160,7 @@ module.exports = function(RED) {
|
||||
node.send(msg); // finally send the array
|
||||
}
|
||||
}
|
||||
catch(e) { node.error(e); }
|
||||
catch(e) { node.error(e,msg); }
|
||||
}
|
||||
else { node.warn("This node only handles csv strings or js objects."); }
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ module.exports = function(RED) {
|
||||
node.send(msg);
|
||||
}
|
||||
} catch (error) {
|
||||
node.error('Error: '+error.message);
|
||||
node.error(error.message,msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ module.exports = function(RED) {
|
||||
msg.payload = JSON.parse(msg.payload);
|
||||
node.send(msg);
|
||||
}
|
||||
catch(e) { node.error(e+ "\n"+msg.payload); }
|
||||
catch(e) { node.error(e.message,msg); }
|
||||
}
|
||||
else if (typeof msg.payload === "object") {
|
||||
if (!Buffer.isBuffer(msg.payload) ) {
|
||||
|
@@ -33,7 +33,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
else if (typeof msg.payload == "string") {
|
||||
parseString(msg.payload, {strict:true,async:true,attrkey:node.attrkey,charkey:node.charkey}, function (err, result) {
|
||||
if (err) { node.error(err); }
|
||||
if (err) { node.error(err, msg); }
|
||||
else {
|
||||
msg.payload = result;
|
||||
node.send(msg);
|
||||
|
Reference in New Issue
Block a user