Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Make get_device return None if the device doesn't exist rather than raising an exception. #11565

Merged
merged 4 commits into from
Dec 13, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply suggestions from code review
Co-authored-by: Sean Quah <[email protected]>
  • Loading branch information
reivilibre and squahtx authored Dec 13, 2021
commit f9b14510dfa2112a81ae2ee40f58ec983f9880ed
2 changes: 1 addition & 1 deletion changelog.d/11565.misc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Make `get_device` return None if the device doesn't exist rather than raising an exception.
Make `get_device` return `None` if the device doesn't exist rather than raising an exception.
3 changes: 2 additions & 1 deletion synapse/storage/databases/main/devices.py
Original file line number Diff line number Diff line change
@@ -111,7 +111,8 @@ async def get_device(
user_id: The ID of the user which owns the device
device_id: The ID of the device to retrieve
Returns:
A dict containing the device information, or None if the device does not exist.
A dict containing the device information, or `None` if the device does not
exist.
"""
return await self.db_pool.simple_select_one(
table="devices",