Traceback if getting profile/server config fails

This commit is contained in:
miruka 2020-05-21 14:14:27 -04:00
parent 5ae71cb7ce
commit 58dd63a850

View File

@ -282,17 +282,17 @@ class MatrixClient(nio.AsyncClient):
if future.cancelled(): # Account logged out if future.cancelled(): # Account logged out
return return
exception = future.exception() try:
resp = future.result()
if exception: except Exception:
log.warn("On %s client startup: %r", self.user_id, exception) trace = traceback.format_exc().rstrip()
log.warn("On %s profile retrieval: %s", self.user_id, trace)
self.profile_task = asyncio.ensure_future( self.profile_task = asyncio.ensure_future(
self.backend.get_profile(self.user_id), self.backend.get_profile(self.user_id),
) )
self.profile_task.add_done_callback(on_profile_response) self.profile_task.add_done_callback(on_profile_response)
return return
resp = future.result()
account = self.models["accounts"][self.user_id] account = self.models["accounts"][self.user_id]
account.profile_updated = datetime.now() account.profile_updated = datetime.now()
account.display_name = resp.displayname or "" account.display_name = resp.displayname or ""
@ -304,20 +304,21 @@ class MatrixClient(nio.AsyncClient):
if future.cancelled(): # Account logged out if future.cancelled(): # Account logged out
return return
exception = future.exception() account = self.models["accounts"][self.user_id]
if exception: try:
log.warn("On %s client startup: %r", self.user_id, exception) account.max_upload_size = future.result()
except Exception:
trace = traceback.format_exc().rstrip()
log.warn(
"On %s server config retrieval: %s", self.user_id, trace,
)
self.server_config_task = asyncio.ensure_future( self.server_config_task = asyncio.ensure_future(
self.get_server_config(), self.get_server_config(),
) )
self.server_config_task.add_done_callback( self.server_config_task.add_done_callback(
on_server_config_response, on_server_config_response,
) )
return
account = self.models["accounts"][self.user_id]
account.max_upload_size = future.result()
self.profile_task = asyncio.ensure_future( self.profile_task = asyncio.ensure_future(
self.backend.get_profile(self.user_id), self.backend.get_profile(self.user_id),