Skip to content
Snippets Groups Projects
Unverified Commit 119c9c10 authored by Aaron's avatar Aaron
Browse files

Get rid of try except


Signed-off-by: default avatarAaron Raimist <aaron@raim.ist>
parent 0b4f4cb0
No related branches found
No related tags found
No related merge requests found
...@@ -38,23 +38,16 @@ class LogoutRestServlet(ClientV1RestServlet): ...@@ -38,23 +38,16 @@ class LogoutRestServlet(ClientV1RestServlet):
@defer.inlineCallbacks @defer.inlineCallbacks
def on_POST(self, request): def on_POST(self, request):
try: requester = yield self.auth.get_user_by_req(request)
requester = yield self.auth.get_user_by_req(request)
except AuthError as e: if requester.device_id is None:
# this implies the access token has already been deleted. # the acccess token wasn't associated with a device.
defer.returnValue((e.code, { # Just delete the access token
"errcode": e.errcode, access_token = self._auth.get_access_token_from_request(request)
"error": e.msg yield self._auth_handler.delete_access_token(access_token)
}))
else: else:
if requester.device_id is None: yield self._device_handler.delete_device(
# the acccess token wasn't associated with a device. requester.user.to_string(), requester.device_id)
# 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)
defer.returnValue((200, {})) defer.returnValue((200, {}))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment