mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Full fix for #11
This commit is contained in:
parent
07ff9aa061
commit
7b4927ff5d
@ -73,18 +73,17 @@
|
||||
if (err) {
|
||||
if (err.status == 404) {
|
||||
RED.notify("<strong>Error</strong>: inject node not deployed","error");
|
||||
} else {
|
||||
} else if (err.status == 500) {
|
||||
RED.notify("<strong>Error</strong>: inject failed, see log for details.","error");
|
||||
} else if (err.status == 0) {
|
||||
RED.notify("<strong>Error</strong>: no response from server","error");
|
||||
} else {
|
||||
RED.notify("<strong>Error</strong>: unexpected error: ("+err.status+")"+err.response,"error");
|
||||
}
|
||||
} else if (resp.status == 200) {
|
||||
RED.notify("Successfully injected: "+label,"success");
|
||||
} else {
|
||||
if (resp) {
|
||||
RED.notify("<strong>Error</strong>: unexpected response: RC "+resp.status+"<br/>See console log for details."error");
|
||||
} else {
|
||||
RED.notify("<strong>Error</strong>: no response from server","error");
|
||||
}
|
||||
console.log(err,resp);
|
||||
RED.notify("<strong>Error</strong>: unexpected response: ("+resp.status+") "+resp.response,"error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -57,8 +57,14 @@ InjectNode.prototype.close = function() {
|
||||
RED.app.post("/inject/:id", function(req,res) {
|
||||
var node = RED.nodes.getNode(req.params.id);
|
||||
if (node != null) {
|
||||
node.receive();
|
||||
res.send(200);
|
||||
try {
|
||||
node.receive();
|
||||
res.send(200);
|
||||
} catch(err) {
|
||||
res.send(500);
|
||||
node.error("Inject failed:"+err);
|
||||
console.log(err.stack);
|
||||
}
|
||||
} else {
|
||||
res.send(404);
|
||||
}
|
||||
|
@ -66,8 +66,10 @@
|
||||
if (err) {
|
||||
if (err.status == 404) {
|
||||
RED.notify("<strong>Error</strong>: debug node not deployed","error");
|
||||
} else {
|
||||
} else if (err.status == 0) {
|
||||
RED.notify("<strong>Error</strong>: no response from server","error");
|
||||
} else {
|
||||
RED.notify("<strong>Error</strong>: unexpected error: ("+err.status+")"+err.response,"error");
|
||||
}
|
||||
} else if (resp.status == 200) {
|
||||
RED.notify("Successfully activated: "+label,"success");
|
||||
@ -80,12 +82,7 @@
|
||||
node.dirty = true;
|
||||
RED.view.redraw();
|
||||
} else {
|
||||
if (resp) {
|
||||
RED.notify("<strong>Error</strong>: unexpected response: "+resp,"error");
|
||||
} else {
|
||||
RED.notify("<strong>Error</strong>: no response from server","error");
|
||||
}
|
||||
console.log(err,resp);
|
||||
RED.notify("<strong>Error</strong>: unexpected response: ("+resp.status+") "+resp.response,"error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user