Correcion mensaje de error

parent b5cc244e
......@@ -7,7 +7,7 @@ module.exports=function(req,res,next){
if(!req.header('x-auth-mcafee-token')){
let error = new Error('Acceso denegado.No existe un token válido.');
log.logger.error(error);
return res.status(config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED')).json({code : config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED') ,error : error})
return res.status(config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED')).json({code : config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED') ,error : error.message})
}
try{
......@@ -15,7 +15,7 @@ try{
if(!decoded) {
let error = new Error('Token con formato incorrecto.');
log.logger.error(error);
return res.status(config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED')).json({code : config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED') ,error : error})
return res.status(config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED')).json({code : config.get('constants.HTTP_STATUS_CODE.UNAUTHORIZED') ,error : error.message})
}
next();
......@@ -23,7 +23,7 @@ try{
}catch(ex){
let error = new Error('Token Inválido');
log.logger.error(error);
res.status(config.get('constants.HTTP_STATUS_CODE.BAD_REQUEST')).json({code:config.get('constants.HTTP_STATUS_CODE.BAD_REQUEST') ,error : error});
res.status(config.get('constants.HTTP_STATUS_CODE.BAD_REQUEST')).json({code:config.get('constants.HTTP_STATUS_CODE.BAD_REQUEST') ,error : error.message});
}
}
\ No newline at end of file
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 to comment