mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
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:
1 parent
943c11714c
commit
88ed447573
6 files changed
+36
-14
No files matched your search
@@ -22,13 +22,13 @@ export async function createSession(req, res) {
|
||||
return
|
||||
}
|
||||
|
||||
const newSession = new Session({
|
||||
user: req.user,
|
||||
quest,
|
||||
containerId: `quest-${quest.id}-${req.user.username}-${Date.now()}`,
|
||||
})
|
||||
|
||||
try {
|
||||
const newSession = new Session({
|
||||
user: req.user,
|
||||
quest,
|
||||
containerId: `quest-${quest.id}-${req.user.username}-${Date.now()}`,
|
||||
})
|
||||
|
||||
const session = await newSession.save()
|
||||
res.status(201).json(session)
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user