Exception msg
This commit is contained in:
parent
b1fe5940fa
commit
74bcd82c3d
@ -110,8 +110,9 @@ class Telegram(RPC):
|
|||||||
invalid_keys = [b for b in chain.from_iterable(cust_keyboard)
|
invalid_keys = [b for b in chain.from_iterable(cust_keyboard)
|
||||||
if b not in valid_keys]
|
if b not in valid_keys]
|
||||||
if len(invalid_keys):
|
if len(invalid_keys):
|
||||||
err_msg = ('config.telegram.keyboard: invalid commands for '
|
err_msg = ('config.telegram.keyboard: Invalid commands for '
|
||||||
f'custom keyboard: {invalid_keys}')
|
f'custom Telegram keyboard: {invalid_keys}'
|
||||||
|
f'\nvalid commands are: {valid_keys}')
|
||||||
raise OperationalException(err_msg)
|
raise OperationalException(err_msg)
|
||||||
else:
|
else:
|
||||||
self._keyboard = cust_keyboard
|
self._keyboard = cust_keyboard
|
||||||
|
@ -1764,8 +1764,9 @@ def test__send_msg_keyboard(default_conf, mocker, caplog) -> None:
|
|||||||
# invalid keyboard in config -> default keyboard
|
# invalid keyboard in config -> default keyboard
|
||||||
freqtradebot.config['telegram']['enabled'] = True
|
freqtradebot.config['telegram']['enabled'] = True
|
||||||
freqtradebot.config['telegram']['keyboard'] = invalid_keys_list
|
freqtradebot.config['telegram']['keyboard'] = invalid_keys_list
|
||||||
err_msg = re.escape("config.telegram.keyboard: invalid commands for "
|
err_msg = re.escape("config.telegram.keyboard: Invalid commands for custom "
|
||||||
"custom keyboard: ['/not_valid', '/alsoinvalid']")
|
"Telegram keyboard: ['/not_valid', '/alsoinvalid']"
|
||||||
|
"\nvalid commands are: ") + r"*"
|
||||||
with pytest.raises(OperationalException, match=err_msg):
|
with pytest.raises(OperationalException, match=err_msg):
|
||||||
telegram = init_telegram(freqtradebot)
|
telegram = init_telegram(freqtradebot)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user