actual-server/util/handle-error.js

12 lines
274 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' });
});
};
2022-05-15 14:47:07 +00:00
}
2022-03-31 17:19:08 +00:00
module.exports = { handleError }