youtube bot: Replace sys.exit() with bot_handler.quit().
MODIFY
zulip_bots/zulip_bots/bots/youtube/test_youtube.py
zulip_bots/zulip_bots/bots/youtube/test_youtube.py
@@ -39,7 +39,7 @@ class TestYoutubeBot(BotTestCase):
with self.mock_config_info({'key': 'somethinginvalid', 'number_of_results': '5', 'video_region': 'US'}), \
self.mock_http_conversation('test_invalid_key'), \
- self.assertRaises(SystemExit) as se: # type: ignore
+ self.assertRaises(bot_handler.BotQuitException):
bot.initialize(bot_handler)
def test_multiple(self) -> None:

MODIFY
zulip_bots/zulip_bots/bots/youtube/youtube.py
zulip_bots/zulip_bots/bots/youtube/youtube.py
@@ -31,9 +31,8 @@ class YoutubeHandler(object):
search_youtube('test', self.config_info['key'], self.config_info['video_region'])
except HTTPError as e:
if (e.response.json()['error']['errors'][0]['reason'] == 'keyInvalid'):
- logging.error('Invalid key.'
+ bot_handler.quit('Invalid key.'
'Follow the instructions in doc.md for setting API key.')
- sys.exit(1)
else:
raise
except ConnectionError:

youtube bot: Replace sys.exit() with bot_handler.quit().