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:
Robert Hönig
2018-02-08 15:51:38 +01:00
committed by Tim Abbott
parent 6638c12aef
commit a19a69bfe3
3 changed files with 32 additions and 12 deletions

View File

@@ -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)