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

Make parser nodes errors actual errors.

(more cleanup will probably be necessary - but this is a start)
This commit is contained in:
dceejay 2015-02-23 19:30:15 +00:00
parent dc7701ad70
commit 9f012c261a
4 changed files with 7 additions and 7 deletions

View File

@ -75,7 +75,7 @@ module.exports = function(RED) {
msg.payload = ou; msg.payload = ou;
node.send(msg); node.send(msg);
} }
catch(e) { node.log(e); } catch(e) { node.error(e); }
} }
else if (typeof msg.payload == "string") { // convert CSV string to object else if (typeof msg.payload == "string") { // convert CSV string to object
try { try {
@ -160,9 +160,9 @@ module.exports = function(RED) {
node.send(msg); // finally send the array node.send(msg); // finally send the array
} }
} }
catch(e) { node.log(e); } catch(e) { node.error(e); }
} }
else { node.log("This node only handles csv strings or js objects."); } else { node.warn("This node only handles csv strings or js objects."); }
} }
}); });
} }

View File

@ -52,7 +52,7 @@ module.exports = function(RED) {
node.send(msg); node.send(msg);
} }
} catch (error) { } catch (error) {
node.log('Error: '+error.message); node.error('Error: '+error.message);
} }
}); });
} }

View File

@ -28,7 +28,7 @@ module.exports = function(RED) {
msg.payload = JSON.parse(msg.payload); msg.payload = JSON.parse(msg.payload);
node.send(msg); node.send(msg);
} }
catch(e) { node.log(e+ "\n"+msg.payload); } catch(e) { node.error(e+ "\n"+msg.payload); }
} }
else if (typeof msg.payload === "object") { else if (typeof msg.payload === "object") {
if (!Buffer.isBuffer(msg.payload) ) { if (!Buffer.isBuffer(msg.payload) ) {
@ -38,7 +38,7 @@ module.exports = function(RED) {
} }
} }
} }
else { node.log("dropped: "+msg.payload); } else { node.warn("dropped: "+msg.payload); }
} }
}); });
} }

View File

@ -40,7 +40,7 @@ module.exports = function(RED) {
} }
}); });
} }
else { node.log("This node only handles xml strings or js objects."); } else { node.warn("This node only handles xml strings or js objects."); }
} }
}); });
} }