mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
reactions: Add error code for duplicate addition/removal.
This commit is contained in:
committed by
Tim Abbott
parent
29bdaaf5b5
commit
871a668dd2
@@ -40,6 +40,8 @@ class ErrorCode(Enum):
|
||||
UNAUTHORIZED = auto()
|
||||
REQUEST_TIMEOUT = auto()
|
||||
MOVE_MESSAGES_TIME_LIMIT_EXCEEDED = auto()
|
||||
REACTION_ALREADY_EXISTS = auto()
|
||||
REACTION_DOES_NOT_EXIST = auto()
|
||||
|
||||
|
||||
class JsonableError(Exception):
|
||||
@@ -503,3 +505,25 @@ class MessageMoveError(JsonableError):
|
||||
return _(
|
||||
"You only have permission to move the {total_messages_allowed_to_move}/{total_messages_in_topic} most recent messages in this topic."
|
||||
)
|
||||
|
||||
|
||||
class ReactionExistsError(JsonableError):
|
||||
code = ErrorCode.REACTION_ALREADY_EXISTS
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def msg_format() -> str:
|
||||
return _("Reaction already exists.")
|
||||
|
||||
|
||||
class ReactionDoesNotExistError(JsonableError):
|
||||
code = ErrorCode.REACTION_DOES_NOT_EXIST
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def msg_format() -> str:
|
||||
return _("Reaction doesn't exist.")
|
||||
|
||||
Reference in New Issue
Block a user