fix: keep handling non error code as errors

This commit is contained in:
Rafael Taranto 2025-05-20 11:33:12 +01:00
parent 6b353af1e3
commit 6824dbb6e9

View file

@ -53,7 +53,12 @@ function getTx(req, res, next) {
return helpers
.fetchStatusTx(req.params.id, req.query.status)
.then(r => res.json(r))
.catch(next)
.catch(err => {
if (err.name === 'HTTPError') {
return res.status(err.code).send(err.message)
}
next(err)
})
}
return next(httpError('Not Found', 404))