summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-08-06 10:44:51 +0100
committerErik Johnston <erik@matrix.org>2024-08-06 10:44:51 +0100
commitf2a4798528c63cdd362149d56c7826ddfa47af03 (patch)
treeae83d6d4a768541a75b216016e7ca1f1fc587d42 /synapse/api/errors.py
parentMerge branch 'rei/twisted_247rc1' into matrix-org-hotfixes (diff)
parentSS: Reset connection if token is unrecognized (#17529) (diff)
downloadsynapse-f2a4798528c63cdd362149d56c7826ddfa47af03.tar.xz
Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r--synapse/api/errors.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py

index dd4a1ae706..99fc7eab54 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py
@@ -128,6 +128,10 @@ class Codes(str, Enum): # MSC2677 DUPLICATE_ANNOTATION = "M_DUPLICATE_ANNOTATION" + # MSC3575 we are telling the client they need to reset their sliding sync + # connection. + UNKNOWN_POS = "M_UNKNOWN_POS" + class CodeMessageException(RuntimeError): """An exception with integer code, a message string attributes and optional headers. @@ -847,3 +851,17 @@ class PartialStateConflictError(SynapseError): msg=PartialStateConflictError.message(), errcode=Codes.UNKNOWN, ) + + +class SlidingSyncUnknownPosition(SynapseError): + """An error that Synapse can return to signal to the client to expire their + sliding sync connection (i.e. send a new request without a `?since=` + param). + """ + + def __init__(self) -> None: + super().__init__( + HTTPStatus.BAD_REQUEST, + msg="Unknown position", + errcode=Codes.UNKNOWN_POS, + )