From 21c83fe55c717acab948a906f8fedaeaa5a79fcc Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Wed, 25 May 2016 09:04:35 -0700 Subject: [PATCH] Handle the missing classroom error properly I think --- server/middleware/classrooms.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/middleware/classrooms.coffee b/server/middleware/classrooms.coffee index 82f004ece..ece79cf6c 100644 --- a/server/middleware/classrooms.coffee +++ b/server/middleware/classrooms.coffee @@ -21,7 +21,7 @@ module.exports = return next() unless code classroom = yield Classroom.findOne({ code: code.toLowerCase() }).select('name ownerID aceConfig') if not classroom - res.status(404).send({}) + throw new errors.NotFound('Classroom not found.') classroom = classroom.toObject() # Tack on the teacher's name for display to the user owner = (yield User.findOne({ _id: mongoose.Types.ObjectId(classroom.ownerID) }).select('name')).toObject()