actual-server/util/handle-error.js
2022-03-31 13:19:08 -04:00

11 lines
275 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 }