Handle callback errors for user, bonfire, challenges,

courseware, and resources controllers
This commit is contained in:
jameskopacz
2015-03-25 20:43:11 -05:00
parent 8a357dd48a
commit c17ff59aef
5 changed files with 53 additions and 42 deletions

View File

@@ -27,7 +27,7 @@ exports.returnNextChallenge = function(req, res) {
}
};
exports.returnChallenge = function(req, res) {
exports.returnChallenge = function(req, res, next) {
var challengeNumber = parseInt(req.params.challengeNumber) || 0;
if (challengeNumber === 2) {
return res.redirect('../challenges/3');
@@ -41,7 +41,7 @@ exports.returnChallenge = function(req, res) {
Challenge.find({}, null, { sort: { challengeNumber: 1 } }, function(err, c) {
if (err) {
debug('Challenge err: ', err);
next(err);
return next(err);
}
res.render('challenges/show', {
title: 'Challenge: ' + c[challengeNumber].name,