Skip to content

Commit 956532a

Browse files
committed
Use new error codes from latest MSC4306 draft
1 parent c6b8a4d commit 956532a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

synapse/api/errors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ class Codes(str, Enum):
141141
INVITE_BLOCKED = "ORG.MATRIX.MSC4155.M_INVITE_BLOCKED"
142142

143143
# Part of MSC4306: Thread Subscriptions
144-
SKIPPED = "M_SKIPPED"
145-
NOT_IN_THREAD = "M_NOT_IN_THREAD"
144+
MSC4306_CONFLICTING_UNSUBSCRIPTION = (
145+
"IO.ELEMENT.MSC4306.M_CONFLICTING_UNSUBSCRIPTION"
146+
)
147+
MSC4306_NOT_IN_THREAD = "IO.ELEMENT.MSC4306.M_NOT_IN_THREAD"
146148

147149

148150
class CodeMessageException(RuntimeError):

synapse/handlers/thread_subscriptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async def subscribe_user_to_thread(
111111
raise SynapseError(
112112
HTTPStatus.BAD_REQUEST,
113113
"Automatic subscription must be caused by an event in the thread",
114-
errcode=Codes.NOT_IN_THREAD,
114+
errcode=Codes.MSC4306_NOT_IN_THREAD,
115115
)
116116

117117
stream_ordering = event.internal_metadata.stream_ordering
@@ -135,7 +135,7 @@ async def subscribe_user_to_thread(
135135
raise SynapseError(
136136
HTTPStatus.CONFLICT,
137137
"Automatic subscription obsoleted by an unsubscription request.",
138-
errcode=Codes.SKIPPED,
138+
errcode=Codes.MSC4306_CONFLICTING_UNSUBSCRIPTION,
139139
)
140140

141141
return outcome

0 commit comments

Comments
 (0)