summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2022-07-27 13:44:40 +0100
committerGitHub <noreply@github.com>2022-07-27 13:44:40 +0100
commit502f075e96b458a183952ae2be402f00b28af299 (patch)
tree63e1bca88c782aef6b9510cb126206816aabca55 /synapse/handlers/message.py
parentMake minor clarifications to the error messages given when we fail to join a ... (diff)
downloadsynapse-502f075e96b458a183952ae2be402f00b28af299.tar.xz
Implement MSC3848: Introduce errcodes for specific event sending failures (#13343)
Implements MSC3848
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index e0bcc40b93..e85b540451 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -41,6 +41,7 @@ from synapse.api.errors import (
     NotFoundError,
     ShadowBanError,
     SynapseError,
+    UnstableSpecAuthError,
     UnsupportedRoomVersionError,
 )
 from synapse.api.room_versions import KNOWN_ROOM_VERSIONS
@@ -149,7 +150,11 @@ class MessageHandler:
                 "Attempted to retrieve data from a room for a user that has never been in it. "
                 "This should not have happened."
             )
-            raise SynapseError(403, "User not in room", errcode=Codes.FORBIDDEN)
+            raise UnstableSpecAuthError(
+                403,
+                "User not in room",
+                errcode=Codes.NOT_JOINED,
+            )
 
         return data
 
@@ -334,7 +339,11 @@ class MessageHandler:
                     break
             else:
                 # Loop fell through, AS has no interested users in room
-                raise AuthError(403, "Appservice not in room")
+                raise UnstableSpecAuthError(
+                    403,
+                    "Appservice not in room",
+                    errcode=Codes.NOT_JOINED,
+                )
 
         return {
             user_id: {