mirror of
https://github.com/zulip/zulip.git
synced 2025-11-18 21:48:30 +00:00
register_server: Improve UX with the "hostname already in use" error.
An even better way than the current json error message recommending the --registration-transfer option is to return an appropriate error code and have that get picked up by the register_server command. The register_server command can then display a more comprehensive, better formatted error message with proper whitespaces and a pointer to the documentation.
This commit is contained in:
committed by
Tim Abbott
parent
6d555b01d0
commit
ddcc36c3aa
@@ -1528,3 +1528,19 @@ class InvalidRemotePushDeviceTokenError(JsonableError):
|
||||
class PushNotificationsDisallowedByBouncerError(Exception):
|
||||
def __init__(self, reason: str) -> None:
|
||||
self.reason = reason
|
||||
|
||||
|
||||
class HostnameAlreadyInUseBouncerError(JsonableError):
|
||||
code = ErrorCode.HOSTNAME_ALREADY_IN_USE_BOUNCER_ERROR
|
||||
|
||||
data_fields = ["hostname"]
|
||||
|
||||
def __init__(self, hostname: str) -> None:
|
||||
self.hostname: str = hostname
|
||||
|
||||
@staticmethod
|
||||
@override
|
||||
def msg_format() -> str:
|
||||
# This message is not read by any of the client apps, just potentially displayed
|
||||
# via server administration tools, so it doesn't need translations.
|
||||
return "A server with hostname {hostname} already exists"
|
||||
|
||||
Reference in New Issue
Block a user