From f81c9c4de1cdb640be054cbb38bbcf36861c14be Mon Sep 17 00:00:00 2001 From: asif Date: Wed, 25 Feb 2026 15:32:30 +0530 Subject: [PATCH] revoke_stop fixed --- src/routes/cheque.route.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/routes/cheque.route.js b/src/routes/cheque.route.js index 5725501..cab479d 100644 --- a/src/routes/cheque.route.js +++ b/src/routes/cheque.route.js @@ -107,8 +107,18 @@ const revokeStop = async (req, res) => { console.log('response from stop cheque api: ', response.data); return res.json(response.data); - } catch (error) { - logger.error('Unable to fetch cheque data: ', error); + } catch (e) { + 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' }); } };