1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-23 23:38:21 +00:00

Catch urllib3 exceptions when sending crash report. Ref https://github.com/GNS3/gns3-gui/issues/3483

This commit is contained in:
grossmj 2023-07-06 17:16:05 +10:00
parent c5c4e1ad56
commit c226b2a9ef

View File

@ -29,6 +29,7 @@ import struct
import platform
import locale
import distro
import urllib3
from .version import __version__, __version_info__
from .config import Config
@ -82,11 +83,15 @@ class CrashReport:
# 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(),