mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
decorator: Extract OrganizationAdministratorRequired common exception.
This eliminates significant code duplication of error messages for situations where an organization administrator is required.
This commit is contained in:
@@ -190,6 +190,18 @@ class InvalidJSONError(JsonableError):
|
||||
def msg_format() -> str:
|
||||
return _("Malformed JSON")
|
||||
|
||||
class OrganizationAdministratorRequired(JsonableError):
|
||||
code = ErrorCode.UNAUTHORIZED_PRINCIPAL # type: ErrorCode
|
||||
|
||||
ADMIN_REQUIRED_MESSAGE = _("Must be an organization administrator")
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__(self.ADMIN_REQUIRED_MESSAGE)
|
||||
|
||||
@staticmethod
|
||||
def msg_format() -> str:
|
||||
return OrganizationAdministratorRequired.ADMIN_REQUIRED_MESSAGE
|
||||
|
||||
class BugdownRenderingException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user