Backend: Implement async error handling wrapper and refactor entry and media controllers to use it
This commit is contained in:
1 parent
ad58164df4
commit
4a1d2bc614
8 files changed
+92
-33
No files matched your search
@@ -0,0 +1,8 @@
|
||||
// Async wrapper utility to catch async errors and pass them to Express error handler
|
||||
const asyncWrapper = (fn) => {
|
||||
return (req, res, next) => {
|
||||
Promise.resolve(fn(req, res, next)).catch(next);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = asyncWrapper;
|
||||
Reference in new issue
Block a user