1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-24 14:54:18 +00:00

#46: Don't crash if Sentry is enabled and greed isn't being run in a git repository

This commit is contained in:
Steffo 2020-04-07 23:54:24 +02:00
parent 45eadb74b2
commit 1523863fed

View file

@ -17,9 +17,13 @@ except ModuleNotFoundError:
if config["Error Reporting"]["sentry_token"] != \ if config["Error Reporting"]["sentry_token"] != \
"https://00000000000000000000000000000000:00000000000000000000000000000000@sentry.io/0000000": "https://00000000000000000000000000000000:00000000000000000000000000000000@sentry.io/0000000":
import raven import raven
import raven.exceptions
try:
release = raven.fetch_git_sha(os.path.dirname(__file__))
except raven.exceptions.InvalidGitRepository:
release = "Unknown"
sentry_client = raven.Client(config["Error Reporting"]["sentry_token"], sentry_client = raven.Client(config["Error Reporting"]["sentry_token"],
release=raven.fetch_git_sha(os.path.dirname(__file__)), release=release,
environment="Dev" if __debug__ else "Prod") environment="Dev" if __debug__ else "Prod")
else: else:
sentry_client = None sentry_client = None