Add node.error handling to core nodes

This commit is contained in:
Nick O'Leary
2015-03-16 13:58:01 +00:00
parent 5efc89d514
commit be61cf6a88
19 changed files with 107 additions and 110 deletions

View File

@@ -68,7 +68,8 @@ module.exports = function(RED) {
}
node.port.write(payload,function(err,res) {
if (err) {
node.error(err);
var errmsg = err.toString().replace("Serialport","Serialport "+node.port.serial.path);
node.error(errmsg,msg);
}
});
});

View File

@@ -470,13 +470,13 @@ module.exports = function(RED) {
});
client.on('error', function() {
node.log('connect failed');
node.error('connect failed',msg);
node.status({fill:"red",shape:"ring",text:"error"});
if (client) { client.end(); }
});
client.on('timeout',function() {
node.log('connect timeout');
node.warn('connect timeout');
if (client) {
client.end();
setTimeout(function() {

View File

@@ -154,7 +154,7 @@ module.exports = function(RED) {
}
sock.send(message, 0, message.length, por, add, function(err, bytes) {
if (err) {
node.error("udp : "+err);
node.error("udp : "+err,msg);
}
message = null;
});