1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-10-16 13:47:27 +00:00

Catch more exceptions

This commit is contained in:
Steffo 2018-04-16 11:15:54 +02:00
parent 575ca37033
commit c46f861de0

View file

@ -4,6 +4,18 @@ import time
from configloader import config
from strings import currency_format_string, currency_symbol
import typing
import os
import sys
if config["Error Reporting"]["sentry_token"] != \
"https://00000000000000000000000000000000:00000000000000000000000000000000@sentry.io/0000000":
import raven
sentry_client = raven.Client(config["Error Reporting"]["sentry_token"],
release=raven.fetch_git_sha(os.path.dirname(__file__)),
environment="Dev" if __debug__ else "Prod")
else:
sentry_client = None
class Price:
@ -111,6 +123,9 @@ def catch_telegram_errors(func):
# Unknown error
except telegram.error.TelegramError:
print(f"Telegram error while calling {func.__name__}(), retrying in 5 secs...")
# Send the error to the Sentry server
if sentry_client is not None:
sentry_client.captureException(exc_info=sys.exc_info())
time.sleep(5)
return result_func