mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-16 10:43:49 +01:00
Remove redundant try/except clauses
The `except SynapseError` clauses were pointless because the wrapped functions would never throw a `SynapseError` (they either throw a `CodeMessageException` or a `RuntimeError`). The `except CodeMessageException` is now also pointless because the caller treats all exceptions equally, so we may as well just throw the `CodeMessageException`.
This commit is contained in:
parent
838810b76a
commit
0cdb32fc43
1 changed files with 11 additions and 23 deletions
|
@ -1090,19 +1090,13 @@ class FederationHandler(BaseHandler):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def do_remotely_reject_invite(self, target_hosts, room_id, user_id):
|
def do_remotely_reject_invite(self, target_hosts, room_id, user_id):
|
||||||
try:
|
origin, event = yield self._make_and_verify_event(
|
||||||
origin, event = yield self._make_and_verify_event(
|
target_hosts,
|
||||||
target_hosts,
|
room_id,
|
||||||
room_id,
|
user_id,
|
||||||
user_id,
|
"leave"
|
||||||
"leave"
|
)
|
||||||
)
|
event = self._sign_event(event)
|
||||||
event = self._sign_event(event)
|
|
||||||
except SynapseError:
|
|
||||||
raise
|
|
||||||
except CodeMessageException as e:
|
|
||||||
logger.warn("Failed to reject invite: %s", e)
|
|
||||||
raise SynapseError(500, "Failed to reject invite")
|
|
||||||
|
|
||||||
# Try the host that we succesfully called /make_leave/ on first for
|
# Try the host that we succesfully called /make_leave/ on first for
|
||||||
# the /send_leave/ request.
|
# the /send_leave/ request.
|
||||||
|
@ -1112,16 +1106,10 @@ class FederationHandler(BaseHandler):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
yield self.replication_layer.send_leave(
|
||||||
yield self.replication_layer.send_leave(
|
target_hosts,
|
||||||
target_hosts,
|
event
|
||||||
event
|
)
|
||||||
)
|
|
||||||
except SynapseError:
|
|
||||||
raise
|
|
||||||
except CodeMessageException as e:
|
|
||||||
logger.warn("Failed to reject invite: %s", e)
|
|
||||||
raise SynapseError(500, "Failed to reject invite")
|
|
||||||
|
|
||||||
context = yield self.state_handler.compute_event_context(event)
|
context = yield self.state_handler.compute_event_context(event)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue