From 25e81c46df571fe107f513646e9bfdd60816dac4 Mon Sep 17 00:00:00 2001 From: Kylmakalle Date: Thu, 6 Jul 2017 00:51:41 +0300 Subject: [PATCH] exceptions test --- bot.py | 6 +++--- vk_messages.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index 0bebc97..c44896a 100644 --- a/bot.py +++ b/bot.py @@ -582,7 +582,7 @@ def reply_sticker(message): except Exception: bot.reply_to(message, '*Произошла неизвестная ошибка при отправке*', parse_mode='Markdown').wait() # TODO?: Bugreport system - logging.exception('Error: {}'.format(traceback.format_exc())) + print('Error: {}'.format(traceback.format_exc())) @bot.message_handler(content_types=['photo']) @@ -610,7 +610,7 @@ def reply_contact(message): except Exception: bot.reply_to(message, '*Произошла неизвестная ошибка при отправке*', parse_mode='Markdown').wait() - logging.exception('Error: {}'.format(traceback.format_exc())) + print('Error: {}'.format(traceback.format_exc())) @bot.message_handler(content_types=['text']) @@ -641,7 +641,7 @@ def reply_text(message): except Exception: bot.reply_to(message, 'Произошла неизвестная ошибка при отправке', parse_mode='Markdown').wait() - logging.exception('Error: {}'.format(traceback.format_exc())) + print('Error: {}'.format(traceback.format_exc())) # bot.polling(none_stop=True) diff --git a/vk_messages.py b/vk_messages.py index df37641..8205110 100644 --- a/vk_messages.py +++ b/vk_messages.py @@ -27,7 +27,7 @@ class VkPolling: handle_updates(vk_user, bot, chat_id, updates) except requests.exceptions.ReadTimeout: timeout *= 2 - logging.warning('Retrying VK Polling in {} seconds.'.format(int(timeout / 10))) + print('Retrying VK Polling in {} seconds.'.format(int(timeout / 10))) for i in range(timeout): if self._running: time.sleep(0.1) @@ -283,9 +283,9 @@ class VkMessage: api = vk.API(self.session) try: new = api.messages.getLongPollHistory(ts=self.ts, pts=self.pts) - except: + except vk.api.VkAPIError: timeout = 3 - logging.warning('Retrying getLongPollHistory in {} seconds'.format(timeout)) + print('Retrying getLongPollHistory in {} seconds'.format(timeout)) time.sleep(timeout) self.ts, self.pts = get_tses(self.session) new = api.messages.getLongPollHistory(ts=self.ts, pts=self.pts)