exceptions: Move InvitationError to zerver/lib/exceptions.

This commit is contained in:
Vishnu KS
2021-06-07 21:41:26 +05:30
committed by Tim Abbott
parent 7197c8ae89
commit 8c055107d9
3 changed files with 15 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
from enum import Enum
from typing import Any, Dict, List, NoReturn, Optional, Type, TypeVar
from typing import Any, Dict, List, NoReturn, Optional, Tuple, Type, TypeVar
from django.utils.translation import gettext as _
@@ -358,3 +358,15 @@ class InvalidSubdomainError(JsonableError):
class ZephyrMessageAlreadySentException(Exception):
def __init__(self, message_id: int) -> None:
self.message_id = message_id
class InvitationError(JsonableError):
code = ErrorCode.INVITATION_FAILED
data_fields = ["errors", "sent_invitations"]
def __init__(
self, msg: str, errors: List[Tuple[str, str, bool]], sent_invitations: bool
) -> None:
self._msg: str = msg
self.errors: List[Tuple[str, str, bool]] = errors
self.sent_invitations: bool = sent_invitations