From 74bcd82c3d28f7ce6c12118cc63f8f0c689eefeb Mon Sep 17 00:00:00 2001 From: Christof Date: Wed, 23 Dec 2020 16:00:01 +0100 Subject: [PATCH] Exception msg --- freqtrade/rpc/telegram.py | 5 +++-- tests/rpc/test_rpc_telegram.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index b520756a9..e2985fbee 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -110,8 +110,9 @@ class Telegram(RPC): invalid_keys = [b for b in chain.from_iterable(cust_keyboard) if b not in valid_keys] if len(invalid_keys): - err_msg = ('config.telegram.keyboard: invalid commands for ' - f'custom keyboard: {invalid_keys}') + err_msg = ('config.telegram.keyboard: Invalid commands for ' + f'custom Telegram keyboard: {invalid_keys}' + f'\nvalid commands are: {valid_keys}') raise OperationalException(err_msg) else: self._keyboard = cust_keyboard diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index df8983324..b8c5d8858 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -1764,8 +1764,9 @@ def test__send_msg_keyboard(default_conf, mocker, caplog) -> None: # invalid keyboard in config -> default keyboard freqtradebot.config['telegram']['enabled'] = True freqtradebot.config['telegram']['keyboard'] = invalid_keys_list - err_msg = re.escape("config.telegram.keyboard: invalid commands for " - "custom keyboard: ['/not_valid', '/alsoinvalid']") + err_msg = re.escape("config.telegram.keyboard: Invalid commands for custom " + "Telegram keyboard: ['/not_valid', '/alsoinvalid']" + "\nvalid commands are: ") + r"*" with pytest.raises(OperationalException, match=err_msg): telegram = init_telegram(freqtradebot)