From 8987ec23e25c1c361661320f56f9d5e52361c5e6 Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Mon, 2 Oct 2017 13:53:53 -0700 Subject: [PATCH] bots: zulip_bot_output.py: Check for absence of handler_class in bot. --- zulip_bots/zulip_bots/zulip_bot_output.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zulip_bots/zulip_bots/zulip_bot_output.py b/zulip_bots/zulip_bots/zulip_bot_output.py index c5c13bb..0160413 100644 --- a/zulip_bots/zulip_bots/zulip_bot_output.py +++ b/zulip_bots/zulip_bots/zulip_bot_output.py @@ -68,7 +68,11 @@ def main(): sys.exit(1) message = {'content': args.message, 'sender_email': 'foo_sender@zulip.com'} - message_handler = lib_module.handler_class() + try: + message_handler = lib_module.handler_class() + except AttributeError: + print("This module does not appear to have a bot handler_class specified.") + sys.exit(1) with patch('zulip.Client') as mock_client: mock_bot_handler = ExternalBotHandler(mock_client, bot_dir)