Skip to content

Commit 674ca35

Browse files
committed
use context manager
1 parent 3b3dac4 commit 674ca35

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sentry_sdk/spotlight.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from typing import Dict
1616
from typing import Optional
1717

18-
from sentry_sdk.utils import logger, env_to_bool
18+
from sentry_sdk.utils import logger, env_to_bool, capture_internal_exceptions
1919
from sentry_sdk.envelope import Envelope
2020

2121

@@ -120,13 +120,11 @@ def setup_spotlight(options):
120120
and settings.DEBUG
121121
and env_to_bool(os.environ.get("SENTRY_SPOTLIGHT_ON_ERROR", "1"))
122122
):
123-
try:
123+
with capture_internal_exceptions():
124124
middleware = settings.MIDDLEWARE
125125
if DJANGO_SPOTLIGHT_MIDDLEWARE_PATH not in middleware:
126126
settings.MIDDLEWARE = type(middleware)(
127127
chain(middleware, (DJANGO_SPOTLIGHT_MIDDLEWARE_PATH,))
128128
)
129-
except Exception as err:
130-
logger.error("Cannot inject Spotlight middleware", exc_info=err)
131129

132130
return SpotlightClient(url)

0 commit comments

Comments
 (0)