From 6de415ed99dd0f8a7b9421772e9caea9ada3d45a Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Tue, 29 Mar 2022 17:11:13 -0700 Subject: [PATCH] server: fix auth 500 errors --- server/src/routes/auth.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts index 9d44eafd..de1aae47 100644 --- a/server/src/routes/auth.ts +++ b/server/src/routes/auth.ts @@ -80,7 +80,11 @@ auth.post( res.status(201).json({ token: token, userId: created_user.id }) } catch (e) { - next(e) + res.status(401).json({ + error: { + message: e.message, + } + }) } } ) @@ -116,7 +120,11 @@ auth.post( throw errorToThrow } } catch (e) { - next(e) + res.status(401).json({ + error: { + message: error, + } + }) } } )