From 016a5030c5c2653d4f6a7bf8fd990dd507911d1a Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Mon, 16 Dec 2013 22:09:54 -0700 Subject: [PATCH] groups: 404 when group not found --- src/controllers/groups.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/groups.js b/src/controllers/groups.js index bd51083f10..e62596a455 100644 --- a/src/controllers/groups.js +++ b/src/controllers/groups.js @@ -194,6 +194,7 @@ api.update = function(req, res, next) { api.attachGroup = function(req, res, next) { Group.findById(req.params.gid, function(err, group){ if(err) return res.json(500, {err:err}); + if(!group) return res.json(404, {err: "Group not found"}); res.locals.group = group; next(); })