Correctly respond w/ 404 error
This commit is contained in:
parent
029aca2e9e
commit
d0c29822ff
|
@ -20,21 +20,21 @@ var load = function load(req, res, next) {
|
|||
if (robot) {
|
||||
req.robot = Cylon.robots[robot];
|
||||
if (!req.robot) {
|
||||
return res.json({ error: "No Robot found with the name " + robot });
|
||||
return res.json(404, { error: "No Robot found with the name " + robot });
|
||||
}
|
||||
}
|
||||
|
||||
if (device) {
|
||||
req.device = req.robot.devices[device];
|
||||
if (!req.device) {
|
||||
return res.json({ error: "No device found with the name " + device });
|
||||
return res.json(404, { error: "No device found with the name " + device });
|
||||
}
|
||||
}
|
||||
|
||||
if (connection) {
|
||||
req.connection = req.robot.connections[connection];
|
||||
if (!req.connection) {
|
||||
return res.json({ error: "No connection found with the name " + connection });
|
||||
return res.json(404, { error: "No connection found with the name " + connection });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue