actual-server/util/handle-error.js
2022-08-29 23:11:51 -04:00

11 lines
276 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 };