Skip to content

Commit cb0743b

Browse files
committed
fix: return null instead of 500 when session user not found
When a Valkey session exists but the DB session row is deleted, getProfile returned 0 rows causing Effect.head to throw NoSuchElementException, which withDbError treated as a 500.
1 parent 20aecfc commit cb0743b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

server/services/userService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ export class UserService extends Effect.Service<UserService>()("UserService", {
6464
.selectFrom("app_public.users")
6565
.selectAll()
6666
.where("id", "=", sql<string>`app_public.current_user_id()`)
67-
.pipe(Effect.head),
67+
.pipe(
68+
Effect.head,
69+
Effect.catchTag("NoSuchElementException", () => Effect.succeed(null)),
70+
),
6871
),
6972

7073
updateProfile: (sessionId: string, input: UpdateProfileInput) =>

0 commit comments

Comments
 (0)