mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
exceptions: Create base class ExpectationMismatchError.
This class will be inherited by all errors related to some sort of mismatch from the expected value. This is a prep commit for #33051, as a part of which we add a new exception class for message content mismatch.
This commit is contained in:
@@ -684,16 +684,29 @@ class TopicWildcardMentionNotAllowedError(JsonableError):
|
||||
return _("You do not have permission to use topic wildcard mentions in this topic.")
|
||||
|
||||
|
||||
class PreviousSettingValueMismatchedError(JsonableError):
|
||||
class ExpectationMismatchError(JsonableError):
|
||||
code: ErrorCode = ErrorCode.EXPECTATION_MISMATCH
|
||||
data_fields = ["field_name"]
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
self.field_name = "field"
|
||||
|
||||
@staticmethod
|
||||
@override
|
||||
def msg_format() -> str:
|
||||
return _("'old' value does not match the expected value.")
|
||||
return _("'{field_name}' value does not match the expected value.")
|
||||
|
||||
|
||||
class PreviousSettingValueMismatchedError(ExpectationMismatchError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.field_name = "old"
|
||||
|
||||
|
||||
class PreviousMessageContentMismatchedError(ExpectationMismatchError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.field_name = "prev_content_sha256"
|
||||
|
||||
|
||||
class SystemGroupRequiredError(JsonableError):
|
||||
|
||||
Reference in New Issue
Block a user