From 93661db0d166444fedc73ea6230c64f653e8c861 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 24 May 2018 10:56:48 +0000 Subject: [PATCH] bots: Print send_message errors for dev debugging. --- zulip_bots/zulip_bots/lib.py | 5 ++++- zulip_bots/zulip_bots/tests/test_lib.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index 482bf4d..875300e 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -140,7 +140,10 @@ class ExternalBotHandler(object): def send_message(self, message: (Dict[str, Any])) -> Dict[str, Any]: if not self._rate_limit.is_legal(): self._rate_limit.show_error_and_exit() - return self._client.send_message(message) + resp = self._client.send_message(message) + if resp.get('result') == 'error': + print("ERROR!: " + str(resp)) + return resp def send_reply(self, message: Dict[str, Any], response: str, widget_content: Optional[str]=None) -> Dict[str, Any]: if message['type'] == 'private': diff --git a/zulip_bots/zulip_bots/tests/test_lib.py b/zulip_bots/zulip_bots/tests/test_lib.py index 63ec939..f3c9c0f 100644 --- a/zulip_bots/zulip_bots/tests/test_lib.py +++ b/zulip_bots/zulip_bots/tests/test_lib.py @@ -32,7 +32,9 @@ class FakeClient: ) def send_message(self, message): - pass + return dict( + result='success', + ) class FakeBotHandler: def usage(self):