mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
embedded bots: Log warning when bot quit()s.
External bots may call bot_handler.quit() when they wish to terminate, e.g. due to a misconfiguration. Currently, embedded bots ignore calls to quit(), even though they signal a problem. This commit does the first step in handling quit() calls by logging a warning.
This commit is contained in:
@@ -57,6 +57,9 @@ class StateHandler:
|
||||
def contains(self, key: Text) -> bool:
|
||||
return is_key_in_bot_storage(self.user_profile, key)
|
||||
|
||||
class EmbeddedBotQuitException(Exception):
|
||||
pass
|
||||
|
||||
class EmbeddedBotHandler:
|
||||
def __init__(self, user_profile: UserProfile) -> None:
|
||||
# Only expose a subset of our UserProfile's functionality
|
||||
@@ -113,3 +116,6 @@ class EmbeddedBotHandler:
|
||||
if optional:
|
||||
return dict()
|
||||
raise
|
||||
|
||||
def quit(self, message: str= "") -> None:
|
||||
raise EmbeddedBotQuitException(message)
|
||||
|
||||
Reference in New Issue
Block a user