Add exception handler to all controllers.
This commit is contained in:
parent
cf55be21eb
commit
1de507b7cb
7 changed files with 42 additions and 34 deletions
|
|
@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
|
||||
//local imports
|
||||
const accountUtils = require('../../../utils/sessionUtils.js');
|
||||
const {exceptionHandler} = require('../../../utils/loggerUtils.js');
|
||||
|
||||
module.exports.get = async function(req, res){
|
||||
if(req.session.user){
|
||||
|
|
@ -23,8 +24,7 @@ module.exports.get = async function(req, res){
|
|||
accountUtils.killSession(req.session);
|
||||
return res.sendStatus(200);
|
||||
}catch(err){
|
||||
res.status(400);
|
||||
return res.send(err.message)
|
||||
return exceptionHandler(res, err);
|
||||
}
|
||||
}else{
|
||||
res.status(400);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue