mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
ruff: Fix N818 exception name should be named with an Error suffix.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
5ae5fe45ff
commit
6c592ce974
@@ -185,7 +185,7 @@ class CannotDeactivateLastUserError(JsonableError):
|
||||
return _("Cannot deactivate the only {entity}.")
|
||||
|
||||
|
||||
class InvalidMarkdownIncludeStatement(JsonableError):
|
||||
class InvalidMarkdownIncludeStatementError(JsonableError):
|
||||
code = ErrorCode.INVALID_MARKDOWN_INCLUDE_STATEMENT
|
||||
data_fields = ["include_statement"]
|
||||
|
||||
@@ -197,7 +197,7 @@ class InvalidMarkdownIncludeStatement(JsonableError):
|
||||
return _("Invalid Markdown include statement: {include_statement}")
|
||||
|
||||
|
||||
class RateLimited(JsonableError):
|
||||
class RateLimitedError(JsonableError):
|
||||
code = ErrorCode.RATE_LIMIT_HIT
|
||||
http_status_code = 429
|
||||
|
||||
@@ -232,7 +232,7 @@ class InvalidJSONError(JsonableError):
|
||||
return _("Malformed JSON")
|
||||
|
||||
|
||||
class OrganizationMemberRequired(JsonableError):
|
||||
class OrganizationMemberRequiredError(JsonableError):
|
||||
code: ErrorCode = ErrorCode.UNAUTHORIZED_PRINCIPAL
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -243,7 +243,7 @@ class OrganizationMemberRequired(JsonableError):
|
||||
return _("Must be an organization member")
|
||||
|
||||
|
||||
class OrganizationAdministratorRequired(JsonableError):
|
||||
class OrganizationAdministratorRequiredError(JsonableError):
|
||||
code: ErrorCode = ErrorCode.UNAUTHORIZED_PRINCIPAL
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -254,7 +254,7 @@ class OrganizationAdministratorRequired(JsonableError):
|
||||
return _("Must be an organization administrator")
|
||||
|
||||
|
||||
class OrganizationOwnerRequired(JsonableError):
|
||||
class OrganizationOwnerRequiredError(JsonableError):
|
||||
code: ErrorCode = ErrorCode.UNAUTHORIZED_PRINCIPAL
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -320,7 +320,7 @@ class PasswordResetRequiredError(AuthenticationFailedError):
|
||||
return _("Your password has been disabled and needs to be reset")
|
||||
|
||||
|
||||
class MarkdownRenderingException(Exception):
|
||||
class MarkdownRenderingError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ class WebhookError(JsonableError):
|
||||
"""
|
||||
Intended as a generic exception raised by specific webhook
|
||||
integrations. This class is subclassed by more specific exceptions
|
||||
such as UnsupportedWebhookEventType and AnomalousWebhookPayload.
|
||||
such as UnsupportedWebhookEventTypeError and AnomalousWebhookPayloadError.
|
||||
"""
|
||||
|
||||
data_fields = ["webhook_name"]
|
||||
@@ -357,14 +357,14 @@ class WebhookError(JsonableError):
|
||||
self.webhook_name = "(unknown)"
|
||||
|
||||
|
||||
class UnsupportedWebhookEventType(WebhookError):
|
||||
class UnsupportedWebhookEventTypeError(WebhookError):
|
||||
"""Intended as an exception for event formats that we know the
|
||||
third-party service generates but which Zulip doesn't support /
|
||||
generate a message for.
|
||||
|
||||
Exceptions where we cannot parse the event type, possibly because
|
||||
the event isn't actually from the service in question, should
|
||||
raise AnomalousWebhookPayload.
|
||||
raise AnomalousWebhookPayloadError.
|
||||
"""
|
||||
|
||||
code = ErrorCode.UNSUPPORTED_WEBHOOK_EVENT_TYPE
|
||||
@@ -379,14 +379,14 @@ class UnsupportedWebhookEventType(WebhookError):
|
||||
return _("The '{event_type}' event isn't currently supported by the {webhook_name} webhook")
|
||||
|
||||
|
||||
class AnomalousWebhookPayload(WebhookError):
|
||||
class AnomalousWebhookPayloadError(WebhookError):
|
||||
"""Intended as an exception for incoming webhook requests that we
|
||||
cannot recognize as having been generated by the service in
|
||||
question. (E.g. because someone pointed a Jira server at the
|
||||
GitHub integration URL).
|
||||
|
||||
If we can parse the event but don't support it, use
|
||||
UnsupportedWebhookEventType.
|
||||
UnsupportedWebhookEventTypeError.
|
||||
|
||||
"""
|
||||
|
||||
@@ -420,7 +420,7 @@ class InvalidSubdomainError(JsonableError):
|
||||
return _("Invalid subdomain")
|
||||
|
||||
|
||||
class ZephyrMessageAlreadySentException(Exception):
|
||||
class ZephyrMessageAlreadySentError(Exception):
|
||||
def __init__(self, message_id: int) -> None:
|
||||
self.message_id = message_id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user