init commit
This commit is contained in:
12
server/middlewares/tryCatch.ts
Executable file
12
server/middlewares/tryCatch.ts
Executable file
@@ -0,0 +1,12 @@
|
||||
export default function tryCatch (cb) {
|
||||
return async (req, res, next) => {
|
||||
try {
|
||||
await cb(req, res, next)
|
||||
// next()
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
next(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user