From 55df1886cc5ca54d7564535b13107acf4be01a8e Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Sun, 7 Jan 2018 09:06:18 -0800 Subject: [PATCH] mypy: Amend hg integration to simplify error handling/typing. --- zulip/integrations/hg/zulip-changegroup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zulip/integrations/hg/zulip-changegroup.py b/zulip/integrations/hg/zulip-changegroup.py index 21dc923..7be7a62 100755 --- a/zulip/integrations/hg/zulip-changegroup.py +++ b/zulip/integrations/hg/zulip-changegroup.py @@ -106,12 +106,13 @@ def send_zulip(email, api_key, site, stream, subject, content): client.send_message(message_data) def get_config(ui, item): - # type: (ui, str) -> Optional[str] + # type: (ui, str) -> str try: # configlist returns everything in lists. return ui.configlist('zulip', item)[0] except IndexError: - return None + ui.warn("Zulip: Could not find required item {} in hg config.".format(item)) + exit(1) def hook(ui, repo, **kwargs): # type: (ui, repo, **Text) -> None