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

+3
View File
@@ -9,6 +9,7 @@ import connectDB from './db.js'
import apiRouter from './api/routes/index.js'
import loadAndUpdateQuests from './utils/quest.js'
import config from './config.js'
import errorHandler from './middleware/error.js'
async function main() {
const app = express()
@@ -28,6 +29,8 @@ async function main() {
app.use('/api/v1', apiRouter)
app.use(errorHandler)
server.listen(config.port, config.host, () => {
console.log(`Server listening at http://${config.host}:${config.port}`)
})