mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
zerver: API to create channel.
Fixes #16206. Co-authored-by: Sahil Batra <sahil@zulip.com> Co-authored-by: Steve Howell <showell@zulip.com> Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
6ef2591b47
commit
6203861529
@@ -17,6 +17,7 @@ class ErrorCode(Enum):
|
||||
BAD_NARROW = auto()
|
||||
CANNOT_DEACTIVATE_LAST_USER = auto()
|
||||
MISSING_HTTP_EVENT_HEADER = auto()
|
||||
CHANNEL_ALREADY_EXISTS = auto()
|
||||
STREAM_DOES_NOT_EXIST = auto()
|
||||
UNAUTHORIZED_PRINCIPAL = auto()
|
||||
UNSUPPORTED_WEBHOOK_EVENT_TYPE = auto()
|
||||
@@ -174,6 +175,20 @@ class UnauthorizedError(JsonableError):
|
||||
return extra_headers_dict
|
||||
|
||||
|
||||
class ChannelExistsError(JsonableError):
|
||||
code = ErrorCode.CHANNEL_ALREADY_EXISTS
|
||||
http_status_code = 409
|
||||
data_fields = ["channel_name"]
|
||||
|
||||
def __init__(self, channel_name: str) -> None:
|
||||
self.channel_name = channel_name
|
||||
|
||||
@staticmethod
|
||||
@override
|
||||
def msg_format() -> str:
|
||||
return _("Channel '{channel_name}' already exists")
|
||||
|
||||
|
||||
class StreamDoesNotExistError(JsonableError):
|
||||
code = ErrorCode.STREAM_DOES_NOT_EXIST
|
||||
data_fields = ["stream"]
|
||||
|
||||
Reference in New Issue
Block a user