From c226b2a9ef5d8a806ce9fcb409ebadd896a4ddcc Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 6 Jul 2023 17:16:05 +1000 Subject: [PATCH] Catch urllib3 exceptions when sending crash report. Ref https://github.com/GNS3/gns3-gui/issues/3483 --- gns3server/crash_report.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index e3806631..4c351c3a 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -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(),