From e5cdb9e2339e321e8a77a898d362d7fbc476303b Mon Sep 17 00:00:00 2001 From: reivilibre Date: Mon, 13 Dec 2021 15:39:43 +0000 Subject: Make `get_device` return None if the device doesn't exist rather than raising an exception. (#11565) Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> --- synapse/handlers/auth.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'synapse/handlers/auth.py') diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index 61607cf2ba..84724b207c 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -997,9 +997,7 @@ class AuthHandler: # really don't want is active access_tokens without a record of the # device, so we double-check it here. if device_id is not None: - try: - await self.store.get_device(user_id, device_id) - except StoreError: + if await self.store.get_device(user_id, device_id) is None: await self.store.delete_access_token(access_token) raise StoreError(400, "Login raced against device deletion") -- cgit 1.5.1