actual-server/util/handle-error.js
2022-05-20 09:24:19 -04:00

11 lines
274 B
JavaScript

function handleError(func) {
return (req, res) => {
func(req, res).catch(err => {
console.log('Error', req.originalUrl, err);
res.status(500);
res.send({ status: 'error', reason: 'internal-error' });
});
};
}
module.exports = { handleError }