revoke_stop fixed
This commit is contained in:
@@ -107,8 +107,18 @@ const revokeStop = async (req, res) => {
|
|||||||
|
|
||||||
console.log('response from stop cheque api: ', response.data);
|
console.log('response from stop cheque api: ', response.data);
|
||||||
return res.json(response.data);
|
return res.json(response.data);
|
||||||
} catch (error) {
|
} catch (e) {
|
||||||
logger.error('Unable to fetch cheque data: ', error);
|
logger.error('Unable to fetch cheque data: ', e);
|
||||||
|
if (axios.isAxiosError(e)) {
|
||||||
|
if (e.response) {
|
||||||
|
// Server responded with a status outside 2xx
|
||||||
|
return res.status(e.response.status).json(e.response.data);
|
||||||
|
} else {
|
||||||
|
return res
|
||||||
|
.status(e.response.status)
|
||||||
|
.json({ error: 'UNKNOWN', message: 'NO_RESPONSE_FROM_CBS' });
|
||||||
|
}
|
||||||
|
}
|
||||||
return res.status(500).json({ error: 'INTERNAL_SERVER_ERROR' });
|
return res.status(500).json({ error: 'INTERNAL_SERVER_ERROR' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user