replace 'except:' with 'except Exception:'

what could possibly go wrong
This commit is contained in:
Richard van der Hoff 2017-10-23 15:52:32 +01:00
parent ecf198aab8
commit eaaabc6c4f
54 changed files with 93 additions and 93 deletions

View file

@ -227,7 +227,7 @@ class FederationHandler(BaseHandler):
state, auth_chain = yield self.replication_layer.get_state_for_room(
origin, pdu.room_id, pdu.event_id,
)
except:
except Exception:
logger.exception("Failed to get state for event: %s", pdu.event_id)
yield self._process_received_pdu(
@ -461,7 +461,7 @@ class FederationHandler(BaseHandler):
def check_match(id):
try:
return server_name == get_domain_from_id(id)
except:
except Exception:
return False
# Parses mapping `event_id -> (type, state_key) -> state event_id`
@ -499,7 +499,7 @@ class FederationHandler(BaseHandler):
continue
try:
domain = get_domain_from_id(ev.state_key)
except:
except Exception:
continue
if domain != server_name:
@ -738,7 +738,7 @@ class FederationHandler(BaseHandler):
joined_domains[dom] = min(d, old_d)
else:
joined_domains[dom] = d
except:
except Exception:
pass
return sorted(joined_domains.items(), key=lambda d: d[1])
@ -940,7 +940,7 @@ class FederationHandler(BaseHandler):
room_creator_user_id="",
is_public=False
)
except:
except Exception:
# FIXME
pass
@ -1775,7 +1775,7 @@ class FederationHandler(BaseHandler):
[e_id for e_id, _ in event.auth_events]
)
seen_events = set(have_events.keys())
except:
except Exception:
# FIXME:
logger.exception("Failed to get auth chain")
@ -1899,7 +1899,7 @@ class FederationHandler(BaseHandler):
except AuthError:
pass
except:
except Exception:
# FIXME:
logger.exception("Failed to query auth chain")
@ -1966,7 +1966,7 @@ class FederationHandler(BaseHandler):
def get_next(it, opt=None):
try:
return it.next()
except:
except Exception:
return opt
current_local = get_next(local_iter)

View file

@ -214,7 +214,7 @@ class InitialSyncHandler(BaseHandler):
})
d["account_data"] = account_data_events
except:
except Exception:
logger.exception("Failed to get snapshot")
yield concurrently_execute(handle_room, room_list, 10)

View file

@ -563,7 +563,7 @@ class MessageHandler(BaseHandler):
try:
dump = ujson.dumps(unfreeze(event.content))
ujson.loads(dump)
except:
except Exception:
logger.exception("Failed to encode content: %r", event.content)
raise

View file

@ -364,7 +364,7 @@ class PresenceHandler(object):
)
preserve_fn(self._update_states)(changes)
except:
except Exception:
logger.exception("Exception in _handle_timeouts loop")
@defer.inlineCallbacks

View file

@ -118,7 +118,7 @@ class ProfileHandler(BaseHandler):
logger.exception("Failed to get displayname")
raise
except:
except Exception:
logger.exception("Failed to get displayname")
else:
defer.returnValue(result["displayname"])
@ -165,7 +165,7 @@ class ProfileHandler(BaseHandler):
if e.code != 404:
logger.exception("Failed to get avatar_url")
raise
except:
except Exception:
logger.exception("Failed to get avatar_url")
defer.returnValue(result["avatar_url"])
@ -266,7 +266,7 @@ class ProfileHandler(BaseHandler):
},
ignore_backoff=True,
)
except:
except Exception:
logger.exception("Failed to get avatar_url")
yield self.store.update_remote_profile_cache(

View file

@ -289,7 +289,7 @@ class RegistrationHandler(BaseHandler):
try:
identity_handler = self.hs.get_handlers().identity_handler
threepid = yield identity_handler.threepid_from_creds(c)
except:
except Exception:
logger.exception("Couldn't validate 3pid")
raise RegistrationError(400, "Couldn't validate 3pid")

View file

@ -108,7 +108,7 @@ class RoomCreationHandler(BaseHandler):
for i in invite_list:
try:
UserID.from_string(i)
except:
except Exception:
raise SynapseError(400, "Invalid user_id: %s" % (i,))
invite_3pid_list = config.get("invite_3pid", [])

View file

@ -61,7 +61,7 @@ class SearchHandler(BaseHandler):
assert batch_group is not None
assert batch_group_key is not None
assert batch_token is not None
except:
except Exception:
raise SynapseError(400, "Invalid batch")
try: