1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Custom exception handler for poll mode

Initial beta of custom exception handler for poll mode.

Use ExceptionHandler class and bot.exception_handler to proceed unhandled exceptions in poll mode.
This commit is contained in:
Badiboy
2020-08-21 17:36:08 +03:00
parent 18eb8eb605
commit 73487f96c4
2 changed files with 75 additions and 19 deletions

View File

@ -975,6 +975,7 @@ def send_invoice(
:param reply_to_message_id: If the message is a reply, ID of the original message
:param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button
:param provider_data: A JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
:param timeout:
:return:
"""
method_url = r'sendInvoice'
@ -1288,7 +1289,7 @@ class ApiTelegramException(ApiException):
"""
def __init__(self, function_name, result, result_json):
super(ApiTelegramException, self).__init__(
"Error code: {0} Description: {1}" \
"Error code: {0}. Description: {1}" \
.format(result_json['error_code'], result_json['description']),
function_name,
result)