fix: error handling

- Remove unnecessary try-catch block in createSession function
- Add error handling for missing session ID in socket.js
- Improve error handling in connectDB function
- Add error handling middleware for server errors
- Add default export for get function in env.js

Signed-off-by: wancat <wancat@wancat.cc>
This commit is contained in:
wancat committed 2023-07-25 15:46:59 +08:00
1 parent 943c11714c
commit 88ed447573
6 files changed
+36 -14

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
// 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
res.status(500).send({ message: err.message }) // Send error response
}