fix: clean error
This commit is contained in:
parent
11943b667c
commit
391fd6d380
1 changed files with 13 additions and 13 deletions
|
@ -28,7 +28,6 @@ module.exports = ({ services: { sortRolesByLevel, signJwt } }) => {
|
|||
let deviceId
|
||||
let roles
|
||||
|
||||
try {
|
||||
const [row] = await sql`
|
||||
SELECT
|
||||
"user_id" as "userId",
|
||||
|
@ -38,12 +37,13 @@ module.exports = ({ services: { sortRolesByLevel, signJwt } }) => {
|
|||
WHERE
|
||||
"auth_token" = ${authToken}
|
||||
`
|
||||
userId = row.userId
|
||||
deviceId = row.deviceId
|
||||
} catch (e) {
|
||||
if (!row) {
|
||||
throw httpError(410, "Auth token not found")
|
||||
}
|
||||
|
||||
userId = row.userId
|
||||
deviceId = row.deviceId
|
||||
|
||||
if (!userId) {
|
||||
await sql.begin(async (sql) => {
|
||||
await sql`set constraints all deferred`
|
||||
|
|
Loading…
Add table
Reference in a new issue