actual-server/util/handle-error.js

12 lines
275 B
JavaScript
Raw Normal View History

2022-03-31 17:19:08 +00:00
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 }