Skip to content

Commit

Permalink
Ignore disconnection errors (#16376)
Browse files Browse the repository at this point in the history
* Ignore webob.request.DisconnectionError exceptions

* Remove outdated comment

* Proper import instead
  • Loading branch information
di authored Aug 7, 2024
1 parent a2e7a8a commit e79f6ad
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions warehouse/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
from sentry_sdk.integrations.pyramid import PyramidIntegration
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
from webob.request import DisconnectionError


def _sentry(request):
return request.registry["sentry"]


# There is an 'ignore_errors' kwarg for sentry_sdk.init() however it is supposedly
# WIP and unstable compared to the 'before_send' kwarg. We can switch to
# 'ignore_errors' once https://github.com/getsentry/sentry-python/issues/149
# is closed.
ignore_exceptions = (
# For some reason we get periodic SystemExit exceptions, I think it is
# because of OpenSSL generating a SIGABRT when OpenSSL_Die() is called, and
Expand All @@ -52,6 +49,8 @@ def _sentry(request):
"gunicorn.http.errors.InvalidProxyLine",
"gunicorn.http.errors.ForbiddenProxyRequest",
"gunicorn.http.errors.InvalidSchemeHeaders",
# Webob raises this when the client disconnects, which we can't do anything about
DisconnectionError,
)


Expand Down

0 comments on commit e79f6ad

Please sign in to comment.