Skip to content

Commit

Permalink
deps: migration to sentry 2.2
Browse files Browse the repository at this point in the history
- raised dependency to 2.2 for last_event_id
- ported tags handling to changed API
  • Loading branch information
nijel committed May 21, 2024
1 parent df594d2 commit f2c7a49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies = [
"redis>=5.0.2,<5.1.0",
"requests>=2.32.1,<2.33",
"ruamel.yaml>=0.17.2,<0.19.0",
"sentry-sdk>=1.45.0,<2.0",
"sentry-sdk>=2.2,<2.3",
"siphashc>=2.1,<3.0",
"social-auth-app-django>=5.4.0,<6.0.0",
"social-auth-core>=4.5.0,<5.0.0",
Expand Down
19 changes: 9 additions & 10 deletions weblate/utils/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ def report_error(
rollbar.report_exc_info(level=level)

if not skip_sentry and settings.SENTRY_DSN:
with sentry_sdk.push_scope() as scope:
scope.set_tag("cause", cause)
if project is not None:
scope.set_tag("project", project.slug)
scope.set_tag("user.locale", get_language())
scope.level = level
if message:
sentry_sdk.capture_message(cause)
else:
sentry_sdk.capture_exception()
sentry_sdk.set_tag("cause", cause)
if project is not None:
sentry_sdk.set_tag("project", project.slug)
sentry_sdk.set_tag("user.locale", get_language())
sentry_sdk.level = level
if message:
sentry_sdk.capture_message(cause)
else:
sentry_sdk.capture_exception()

log = getattr(LOGGER, level)

Expand Down

0 comments on commit f2c7a49

Please sign in to comment.