working on issue #305

parent ce23981e
......@@ -652,8 +652,7 @@ module.exports = {
*/
students: function (req, res) {
if (!req.params.id) {
return res.json(500, {
error: 'No supervisor defined'
return res.badRequest('No supervisor defined');
});
}
Supervisor.students(req.params.id, function (err, stus) {
......@@ -670,7 +669,7 @@ module.exports = {
return res.badRequest();
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);
});
},
......
......@@ -240,7 +240,7 @@ module.exports = {
})
.spread(function (sup, stuSups) {
if (!stuSups || stuSups.length == 0)
return throw new Error("No students");
throw new Error("No students");
async.eachSeries(stuSups, function(stuSup, next_cb) {
// set current method and instruction if any
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