working on issue #305

parent ce23981e
...@@ -652,8 +652,7 @@ module.exports = { ...@@ -652,8 +652,7 @@ module.exports = {
*/ */
students: function (req, res) { students: function (req, res) {
if (!req.params.id) { if (!req.params.id) {
return res.json(500, { return res.badRequest('No supervisor defined');
error: 'No supervisor defined'
}); });
} }
Supervisor.students(req.params.id, function (err, stus) { Supervisor.students(req.params.id, function (err, stus) {
...@@ -670,7 +669,7 @@ module.exports = { ...@@ -670,7 +669,7 @@ module.exports = {
return res.badRequest(); return res.badRequest();
Supervisor.commonStudents(req.params.id_sup, req.params.id_off, function (err, stus) { Supervisor.commonStudents(req.params.id_sup, req.params.id_off, function (err, stus) {
if (err) throw err; if (err) return res.serverError(err);
return res.ok(stus); return res.ok(stus);
}); });
}, },
......
...@@ -240,7 +240,7 @@ module.exports = { ...@@ -240,7 +240,7 @@ module.exports = {
}) })
.spread(function (sup, stuSups) { .spread(function (sup, stuSups) {
if (!stuSups || stuSups.length == 0) if (!stuSups || stuSups.length == 0)
return throw new Error("No students"); throw new Error("No students");
async.eachSeries(stuSups, function(stuSup, next_cb) { async.eachSeries(stuSups, function(stuSup, next_cb) {
// set current method and instruction if any // set current method and instruction if any
Student.findOne(stuSup.student.id) Student.findOne(stuSup.student.id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment