diff options
author | Erik Johnston <erik@matrix.org> | 2014-11-04 15:10:43 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-11-04 15:10:43 +0000 |
commit | 2a49f177fe39ee15c7fc2915db9aadb6152bc547 (patch) | |
tree | 8c48ace1a514d9a5693e2c4c2ebfbf88122c64fc /synapse/handlers | |
parent | Move FederationError to synapse.api.errors (diff) | |
download | synapse-2a49f177fe39ee15c7fc2915db9aadb6152bc547.tar.xz |
On AuthError, raise a FederationError
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/federation.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 49bfff88a4..8848656b1d 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -17,6 +17,7 @@ from ._base import BaseHandler +from synapse.api.errors import AuthError, FederationError from synapse.api.events.room import RoomMemberEvent from synapse.api.constants import Membership from synapse.util.logutils import log_function @@ -116,8 +117,15 @@ class FederationHandler(BaseHandler): logger.debug("Event: %s", event) - if not backfilled: + try: yield self.auth.check(event, None, raises=True) + except AuthError as e: + raise FederationError( + "ERROR", + e.code, + e.msg, + affected=event.event_id, + ) is_new_state = is_new_state and not backfilled |