Skip to content

Commit 0932e60

Browse files
committed
Fix python3 Exception message attribute not found.
1 parent f513270 commit 0932e60

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎telebot/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def __polling(self, none_stop, interval):
155155
if not none_stop:
156156
self.__stop_polling.set()
157157
logger.info("TeleBot: Exception occurred. Stopping.")
158-
logger.error(e.message)
158+
logger.error(e)
159159

160160
logger.info('TeleBot: Stopped polling.')
161161

‎tests/test_telebot.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ def test_send_file():
7777
assert ret_msg.message_id
7878

7979

80+
def test_send_file_exception():
81+
tb = telebot.TeleBot(TOKEN)
82+
try:
83+
ret_msg = tb.send_document(CHAT_ID, None)
84+
assert False
85+
except Exception as e:
86+
print(e)
87+
assert True
88+
89+
8090
def test_send_photo_by_id():
8191
photo_id = 'AgADBQADTKgxG8YifgbcWQAB7Da9yYIx1rEyAAT-HYJ3CrJEqdA2AQABAg'
8292
tb = telebot.TeleBot(TOKEN)

0 commit comments

Comments
 (0)