groups: 404 when group not found

This commit is contained in:
Tyler Renelle 2013-12-16 22:09:54 -07:00
parent 4650e2f592
commit 016a5030c5

View file

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