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

Ensure error messages are toStringed

This commit is contained in:
Nick O'Leary 2015-06-16 16:09:53 +01:00
parent 48df31d7b7
commit 9ca102cf81
8 changed files with 23 additions and 23 deletions

View File

@ -84,7 +84,7 @@ module.exports = function(RED) {
res.send(200);
} catch(err) {
res.send(500);
node.error(RED._("inject.failed",{error:err}));
node.error(RED._("inject.failed",{error:err.toString()}));
}
} else {
res.send(404);

View File

@ -40,11 +40,11 @@
&nbsp;<span id="pitype"></span>
</div>
<div class="form-row">
<label for="node-input-intype"><i class="fa fa-level-up"></i> <span data-i18n="rpi-gpio.label.registor"></span></label>
<label for="node-input-intype"><i class="fa fa-level-up"></i> <span data-i18n="rpi-gpio.label.resistor"></span></label>
<select type="text" id="node-input-intype" style="width: 150px;">
<option value="tri" data-i18n="rpi-gpio.registor.none"></option>
<option value="up" data-i18n="rpi-gpio.registor.pullup"></option>
<option value="down" data-i18n="rpi-gpio.registor.pulldown"></option>
<option value="tri" data-i18n="rpi-gpio.resistor.none"></option>
<option value="up" data-i18n="rpi-gpio.resistor.pullup"></option>
<option value="down" data-i18n="rpi-gpio.resistor.pulldown"></option>
</select>
</div>
<div class="form-row">

View File

@ -99,7 +99,7 @@ module.exports = function(RED) {
node.child.on('error', function (err) {
if (err.errno === "ENOENT") { node.error(RED._("rpi-gpio.errors.commandnotfound")); }
else if (err.errno === "EACCES") { node.error(RED._("rpi-gpio.errors.commandnotexecutable")); }
else { node.error(RED._("rpi-gpio.errors.error",{error:err.errnp})) }
else { node.error(RED._("rpi-gpio.errors.error",{error:err.errno})) }
});
}

View File

@ -183,13 +183,13 @@ module.exports = function(RED) {
});
server.on('error', function(err) {
if (err) {
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err.toString()}));
}
});
server.listen(node.port, function(err) {
if (err) {
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err.toString()}));
} else {
node.log(RED._("tcpin.status.listening-port",{port:node.port}));
node.on('close', function() {
@ -236,7 +236,7 @@ module.exports = function(RED) {
node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")});
});
client.on('error', function (err) {
node.log(RED._("tcpin.errors.error",{error:err}));
node.log(RED._("tcpin.errors.error",{error:err.toString()}));
});
client.on('end', function (err) {
});
@ -343,13 +343,13 @@ module.exports = function(RED) {
server.on('error', function(err) {
if (err) {
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err.toString()}));
}
});
server.listen(node.port, function(err) {
if (err) {
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err.toString()}));
} else {
node.log(RED._("tcpin.status.listening-port",{port:node.port}));
node.on('close', function() {

View File

@ -280,8 +280,8 @@
"return": {
"timeout": "after a fixed timeout of",
"character": "when character received is",
"number": "a fixed number of chars:",
"never": "keep connection open"
"number": "a fixed number of chars",
"never": "never - keep connection open"
},
"status": {
"connecting": "connecting to __host__:__port__",
@ -499,7 +499,7 @@
"label": {
"gpiopin": "GPIO Pin",
"selectpin": "select pin",
"registor": "Registor?",
"resistor": "Resistor?",
"readinitial": "Read initial state of pin on deploy/restart?",
"type": "Type",
"initpin": "Initialise pin state?",
@ -509,7 +509,7 @@
"right": "Right",
"middle": "Middle"
},
"registor": {
"resistor": {
"none": "none",
"pullup": "pullup",
"pulldown": "pulldown"

View File

@ -47,13 +47,13 @@ module.exports = function(RED) {
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while
//fs.writeFile(filename, data, {encoding:"binary"}, function (err) {
fs.writeFile(filename, data, "binary", function (err) {
if (err) { node.error(RED._("file.errors.writefail",{error:err}),msg); }
if (err) { node.error(RED._("file.errors.writefail",{error:err.toString()}),msg); }
else if (RED.settings.verbose) { node.log(RED._("file.status.wrotefile",{file:filename})); }
});
}
else if (this.overwriteFile === "delete") {
fs.unlink(filename, function (err) {
if (err) { node.error(RED._("file.errors.deletefail",{error:err}),msg); }
if (err) { node.error(RED._("file.errors.deletefail",{error:err.toString()}),msg); }
else if (RED.settings.verbose) { node.log(RED._("file.status.deletedfile",{file:filename})); }
});
}
@ -61,7 +61,7 @@ module.exports = function(RED) {
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while longer
//fs.appendFile(filename, data, {encoding:"binary"}, function (err) {
fs.appendFile(filename, data, "binary", function (err) {
if (err) { node.error(RED._("file.errors.appendfail",{error:err}),msg); }
if (err) { node.error(RED._("file.errors.appendfail",{error:err.toString()}),msg); }
else if (RED.settings.verbose) { node.log(RED._("file.status.appendedfile",{file:filename})); }
});
}

View File

@ -35,7 +35,7 @@ function createLibrary(type) {
}
}).otherwise(function(err) {
if (err) {
log.warn(log._("api.library.error-load-entry",{path:path,message:err}));
log.warn(log._("api.library.error-load-entry",{path:path,message:err.toString()}));
if (err.code === 'forbidden') {
log.audit({event: "library.get",type:type,error:"forbidden"},req);
res.send(403);
@ -57,7 +57,7 @@ function createLibrary(type) {
log.audit({event: "library.set",type:type},req);
res.send(204);
}).otherwise(function(err) {
log.warn(log._("api.library.error-save-entry",{path:path,message:err}));
log.warn(log._("api.library.error-save-entry",{path:path,message:err.toString()}));
if (err.code === 'forbidden') {
log.audit({event: "library.set",type:type,error:"forbidden"},req);
res.send(403);
@ -89,7 +89,7 @@ module.exports = {
res.send(data);
}).otherwise(function(err) {
if (err) {
log.warn(log._("api.library.error-load-flow",{path:req.params[0],message:err}));
log.warn(log._("api.library.error-load-flow",{path:req.params[0],message:err.toString()}));
if (err.code === 'forbidden') {
log.audit({event: "library.get",type:"flow",path:req.params[0],error:"forbidden"},req);
res.send(403);
@ -106,7 +106,7 @@ module.exports = {
log.audit({event: "library.set",type:"flow",path:req.params[0]},req);
res.send(204);
}).otherwise(function(err) {
log.warn(log._("api.library.error-save-flow",{path:req.params[0],message:err}));
log.warn(log._("api.library.error-save-flow",{path:req.params[0],message:err.toString()}));
if (err.code === 'forbidden') {
log.audit({event: "library.set",type:"flow",path:req.params[0],error:"forbidden"},req);
res.send(403);

View File

@ -58,7 +58,7 @@ var flowNodes = module.exports = {
flowNodes.startFlows();
});
}).otherwise(function(err) {
log.warn(log._("nodes.flows.error",{err:err}));
log.warn(log._("nodes.flows.error",{message:err.toString()}));
console.log(err.stack);
});
},