Skip to content

Commit 6733512

Browse files
author
Alan Shaw
authored
fix: do not swallow error
1 parent 8b90bfa commit 6733512

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/api/src/utils/auth-v1.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ export async function loginOrRegister(event, data) {
9393
github: parsed.github,
9494
})
9595

96-
if (upsert.data === null) {
97-
throw new Error('Could not retrieve user from db.')
98-
}
99-
10096
if (upsert.error) {
10197
// @ts-ignore
10298
throw new Error(`DB error: ${JSON.stringify(upsert.error)}`)
10399
}
100+
101+
if (upsert.data === null) {
102+
throw new Error('Could not retrieve user from db.')
103+
}
104+
104105
const user = upsert.data[0]
105106

106107
return { user, tokenName: 'session' }

0 commit comments

Comments
 (0)