Get rid of try except

Signed-off-by: Aaron Raimist <aaron@raim.ist>
pull/5256/head
Aaron Raimist 2019-05-27 00:13:48 -05:00
parent 0b4f4cb0b4
commit 119c9c10b0
No known key found for this signature in database
GPG Key ID: 37419210002890EF
1 changed files with 9 additions and 16 deletions

View File

@ -38,23 +38,16 @@ class LogoutRestServlet(ClientV1RestServlet):
@defer.inlineCallbacks
def on_POST(self, request):
try:
requester = yield self.auth.get_user_by_req(request)
except AuthError as e:
# this implies the access token has already been deleted.
defer.returnValue((e.code, {
"errcode": e.errcode,
"error": e.msg
}))
requester = yield self.auth.get_user_by_req(request)
if requester.device_id is None:
# the acccess token wasn't associated with a device.
# Just delete the access token
access_token = self._auth.get_access_token_from_request(request)
yield self._auth_handler.delete_access_token(access_token)
else:
if requester.device_id is None:
# the acccess token wasn't associated with a device.
# Just delete the access token
access_token = self._auth.get_access_token_from_request(request)
yield self._auth_handler.delete_access_token(access_token)
else:
yield self._device_handler.delete_device(
requester.user.to_string(), requester.device_id)
yield self._device_handler.delete_device(
requester.user.to_string(), requester.device_id)
defer.returnValue((200, {}))