Catch and return unexpected exceptions during API calls
This commit is contained in:
parent
f525caa2e5
commit
72a7dd5a5f
@ -14,7 +14,7 @@ __author__ = "Davide Testa"
|
||||
__email__ = "davide@davte.it"
|
||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||
__license__ = "GNU General Public License v3.0"
|
||||
__version__ = "2.2.7"
|
||||
__version__ = "2.2.8"
|
||||
__maintainer__ = "Davide Testa"
|
||||
__contact__ = "t.me/davte"
|
||||
|
||||
|
@ -298,12 +298,15 @@ class TelegramBot(object):
|
||||
"request"
|
||||
)
|
||||
self.set_flood_wait(flood_wait)
|
||||
return e
|
||||
response_object = e
|
||||
except Exception as e:
|
||||
logging.error(f"{e}", exc_info=True)
|
||||
return e
|
||||
response_object = e
|
||||
except asyncio.TimeoutError as e:
|
||||
logging.info(f"{e}: {method} API call timed out")
|
||||
except Exception as e:
|
||||
logging.info(f"Unexpected eception:\n{e}")
|
||||
response_object = e
|
||||
finally:
|
||||
if session_must_be_closed and not session.closed:
|
||||
await session.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user