Skip to content

Commit

Permalink
Catch urllib3 exceptions when sending crash report. Ref #3483
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Jul 6, 2023
1 parent 2987bcf commit e11ce27
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions gns3/crash_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import platform
import struct
import distro
import urllib3

try:
import sentry_sdk
Expand Down Expand Up @@ -75,11 +76,15 @@ def __init__(self):
# Don't send log records as events.
sentry_logging = LoggingIntegration(level=logging.INFO, event_level=None)

sentry_sdk.init(dsn=CrashReport.DSN,
release=__version__,
ca_certs=cacert,
default_integrations=False,
integrations=[sentry_logging])
try:
sentry_sdk.init(dsn=CrashReport.DSN,
release=__version__,
ca_certs=cacert,
default_integrations=False,
integrations=[sentry_logging])
except urllib3.exceptions.HTTPError as e:
log.error("Crash report could not be sent: {}".format(e))
return

tags = {
"os:name": platform.system(),
Expand Down

0 comments on commit e11ce27

Please sign in to comment.