Correctly respond w/ 404 error

This commit is contained in:
Andrew Stewart 2014-07-28 10:01:16 -07:00
parent 029aca2e9e
commit d0c29822ff
1 changed files with 3 additions and 3 deletions

View File

@ -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 });
}
}