1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-18 06:18:08 +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 platform
import locale import locale
import distro import distro
import urllib3
from .version import __version__, __version_info__ from .version import __version__, __version_info__
from .config import Config from .config import Config
@ -82,11 +83,15 @@ class CrashReport:
# Don't send log records as events. # Don't send log records as events.
sentry_logging = LoggingIntegration(level=logging.INFO, event_level=None) sentry_logging = LoggingIntegration(level=logging.INFO, event_level=None)
try:
sentry_sdk.init(dsn=CrashReport.DSN, sentry_sdk.init(dsn=CrashReport.DSN,
release=__version__, release=__version__,
ca_certs=cacert, ca_certs=cacert,
default_integrations=False, default_integrations=False,
integrations=[sentry_logging]) integrations=[sentry_logging])
except urllib3.exceptions.HTTPError as e:
log.error("Crash report could not be sent: {}".format(e))
return
tags = { tags = {
"os:name": platform.system(), "os:name": platform.system(),