1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2025-02-16 13:43:58 +00:00

Display the full error in debug mode

This commit is contained in:
Steffo 2018-09-19 01:23:04 +02:00
parent 3a998075c5
commit c2bed5869b

View file

@ -128,9 +128,12 @@ def catch_telegram_errors(func):
f" retrying in {config['Telegram']['timed_out_pause']} secs...")
time.sleep(int(config["Telegram"]["timed_out_pause"]))
# Telegram is not reachable
except telegram.error.NetworkError:
except telegram.error.NetworkError as error:
print(f"Network error while calling {func.__name__}(),"
f" retrying in {config['Telegram']['error_pause']} secs...")
# Display the full NetworkError if in debug mode
if __debug__:
print(f"Full error: {error.message}")
time.sleep(int(config["Telegram"]["error_pause"]))
# Unknown error
except telegram.error.TelegramError as error:
@ -145,8 +148,11 @@ def catch_telegram_errors(func):
else:
print(f"Telegram error while calling {func.__name__}(),"
f" retrying in {config['Telegram']['error_pause']} secs...")
# Display the full TelegramError if in debug mode
if __debug__:
print(f"Full error: {error.message}")
# Send the error to the Sentry server
if sentry_client is not None:
elif sentry_client is not None:
sentry_client.captureException(exc_info=sys.exc_info())
time.sleep(int(config["Telegram"]["error_pause"]))
return result_func