SQL error with HTTP request

In the case the SQL node is in a flow with http in and out, the flow end
in case of error but the http client is waiting for an answer. So we
must not endded the flow but send back the error.
This commit is contained in:
Paul Renault 2016-02-26 12:06:28 +01:00
parent c01a1745db
commit 7469633337

View File

@ -103,8 +103,11 @@ module.exports = function(RED) {
//console.log("query:",msg.topic);
var bind = Array.isArray(msg.payload) ? msg.payload : [];
node.mydbConfig.connection.query(msg.topic, bind, function(err, rows) {
if (err) { node.error(err,msg); }
else {
if (err) {
node.warn(err);
msg.error = err;
node.send(msg);
}else {
msg.payload = rows;
node.send(msg);
}