Starting on working bookmarks api
This commit is contained in:
12
web/lib/apiHelpers.js
Normal file
12
web/lib/apiHelpers.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function withErrorHandling(handler) {
|
||||
return async (req, res) => {
|
||||
try {
|
||||
await handler(req, res);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
res.status(error.status || 500).end(error.message);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export { withErrorHandling };
|
||||
Reference in New Issue
Block a user