diff --git a/src/controllers/train.controllers.js b/src/controllers/train.controllers.js index f85194f..3c64f69 100644 --- a/src/controllers/train.controllers.js +++ b/src/controllers/train.controllers.js @@ -4,7 +4,7 @@ async function getByHeadcodeToday(req, res, next){ if (!req.isAuthed) { const err = new Error('Unauthorized'); err.status = 401; - throw err; + next(err) } try { var searchHeadcode = req.params.id; @@ -20,7 +20,7 @@ async function get(req, res, next) { if (!req.isAuthed) { const err = new Error('Unauthorized'); err.status = 401; - throw err; + next(err); } let date = req.params.date; let searchType = req.params.searchType;