fix: wrap all async controller with error handler

* add validations to newCommand
This commit is contained in:
wancat authored and Lin, Hung-Shin committed 2023-11-14 10:45:24 +08:00
1 parent 1af85651b8
commit c2dac8d385
13 files changed
+120 -120

No files matched your search

+6
View File
@@ -1,3 +1,9 @@
export function asyncHandler(fn) {
return (req, res, next) => {
fn(req, res, next).catch(next)
}
}
// eslint-disable-next-line no-unused-vars
export default function errorHandler(err, req, res, next) {
console.error(err.stack) // Log error stack trace to the console