From 2a6e78356f11af814a529e073f118e5fdee9f2a9 Mon Sep 17 00:00:00 2001 From: Sylvie Date: Sun, 3 Dec 2023 17:03:13 -0700 Subject: [PATCH] fix: missing error logs in api --- backend/routers/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/routers/api.ts b/backend/routers/api.ts index ab2641e..5b07334 100644 --- a/backend/routers/api.ts +++ b/backend/routers/api.ts @@ -53,6 +53,7 @@ router.post('/setup', BodyParserJson(), async (req, res) => { return res.json({ success: true }); } catch (err: any) { + log.error('Setup failed', err); return res.status(400).json({ success: false, message: err.message }); } }); @@ -84,7 +85,7 @@ router.post('/login', rateLimiterMiddleware('login', UserConfig.config?.rateLimi // Delete the pre-login path after successful login if (success) delete req.session.ass?.preLoginPath; }) - .catch((err) => res.status(400).json({ success: false, message: err.message })); + .catch((err) => log.error(err).callback(() => res.status(400).json({ success: false, message: err.message }))); }); // todo: authenticate API endpoints