From 0932e603fbc75a6bbd03d912faab602a8139ef51 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Thu, 23 Jul 2015 09:14:20 +0800 Subject: [PATCH] Fix python3 Exception message attribute not found. --- telebot/__init__.py | 2 +- tests/test_telebot.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 1f7c106..df6c813 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -155,7 +155,7 @@ class TeleBot: if not none_stop: self.__stop_polling.set() logger.info("TeleBot: Exception occurred. Stopping.") - logger.error(e.message) + logger.error(e) logger.info('TeleBot: Stopped polling.') diff --git a/tests/test_telebot.py b/tests/test_telebot.py index 7846cc9..4f2f079 100644 --- a/tests/test_telebot.py +++ b/tests/test_telebot.py @@ -77,6 +77,16 @@ def test_send_file(): assert ret_msg.message_id +def test_send_file_exception(): + tb = telebot.TeleBot(TOKEN) + try: + ret_msg = tb.send_document(CHAT_ID, None) + assert False + except Exception as e: + print(e) + assert True + + def test_send_photo_by_id(): photo_id = 'AgADBQADTKgxG8YifgbcWQAB7Da9yYIx1rEyAAT-HYJ3CrJEqdA2AQABAg' tb = telebot.TeleBot(TOKEN)