Correcion mensaje de error

parent b5cc244e
...@@ -7,7 +7,7 @@ module.exports=function(req,res,next){ ...@@ -7,7 +7,7 @@ module.exports=function(req,res,next){
if(!req.header('x-auth-mcafee-token')){ if(!req.header('x-auth-mcafee-token')){
let error = new Error('Acceso denegado.No existe un token válido.'); let error = new Error('Acceso denegado.No existe un token válido.');
log.logger.error(error); 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{ try{
...@@ -15,7 +15,7 @@ try{ ...@@ -15,7 +15,7 @@ try{
if(!decoded) { if(!decoded) {
let error = new Error('Token con formato incorrecto.'); let error = new Error('Token con formato incorrecto.');
log.logger.error(error); 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(); next();
...@@ -23,7 +23,7 @@ try{ ...@@ -23,7 +23,7 @@ try{
}catch(ex){ }catch(ex){
let error = new Error('Token Inválido'); let error = new Error('Token Inválido');
log.logger.error(error); 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