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>
This commit is contained in:
reivilibre 2021-12-13 15:39:43 +00:00 committed by GitHub
parent aa8708ebed
commit e5cdb9e233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 13 deletions

View file

@ -63,6 +63,8 @@ class DeviceRestServlet(RestServlet):
device = await self.device_handler.get_device(
target_user.to_string(), device_id
)
if device is None:
raise NotFoundError("No device found")
return HTTPStatus.OK, device
async def on_DELETE(