Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

users: Narrow the embedded bot config validation try block.

Niloth Pd431049745ce
diff --git a/zerver/lib/users.py b/zerver/lib/users.py
index f8155508360..9ce0f344000 100644
--- a/zerver/lib/users.py
+++ b/zerver/lib/users.py
@@ -167,12 +167,14 @@ def check_valid_incoming_webhook_bot_config(
def check_valid_embedded_bot_config(service_name: str, config_data: Mapping[str, str]) -> None:
- try:
- from zerver.lib.bot_lib import get_bot_handler
+ from zerver.lib.bot_lib import get_bot_handler
+
+ bot_handler = get_bot_handler(service_name)
+ if not hasattr(bot_handler, "validate_config"):
+ return
- bot_handler = get_bot_handler(service_name)
- if hasattr(bot_handler, "validate_config"):
- bot_handler.validate_config(config_data)
+ try:
+ bot_handler.validate_config(config_data)
except ConfigValidationError:
# The exception provides a specific error message, but that
# message is not tagged translatable, because it is