From c56c37c35198488732ba86ad4dbbde2241002b2d Mon Sep 17 00:00:00 2001 From: Davte Date: Fri, 26 Jul 2019 14:03:33 +0200 Subject: [PATCH] Make send_document return an Exception if document to send is not found --- davtelepot/bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/davtelepot/bot.py b/davtelepot/bot.py index 67e156f..da10d95 100644 --- a/davtelepot/bot.py +++ b/davtelepot/bot.py @@ -1273,17 +1273,17 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): or 'Document' ) document = buffered_file - except FileNotFoundError: - document = None + except FileNotFoundError as e: if buffered_file: buffered_file.close() + return e else: use_stored_file_id = False if document is None: logging.error( "`document` is None, `send_document` returning..." ) - return + return Exception("No `document` provided") sent_update = None try: sent_update = await self.sendDocument(