Skip to content

Commit

Permalink
Recover gracefully when SENTRY_DSN is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchrisadams committed Feb 21, 2024
1 parent 95cee5f commit 3a20fc2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/theme/context_processors/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ def sentry_info(request: HttpRequest):
"""
Add sentry configuration to the context in a HTTP request.
This allows for the sentry config to be used in templates for front end libraries.
This allows for the sentry config to be used in templates for
frontend libraries.
"""

# exit early if we don't have a sentry DSN set up
if not settings.SENTRY_DSN:
try:
sentry_dsn = settings.SENTRY_DSN
except AttributeError:
return {}

return {
Expand Down

0 comments on commit 3a20fc2

Please sign in to comment.