Skip to content

Opaque with_scope behaviour with exceptions in block #1855

Open
@sl0thentr0py

Description

@sl0thentr0py

Creating this issue for further discussion.

If you do the following, the exception will be captured but the tag won't be used (because that scope is thrown away in an ensure).

    Sentry.with_scope do |scope|
      scope.set_tags(my_tag: "my value")
      1 / 0
    end

If you do the following, the exception will be captured and the tag will be visible.

    Sentry.with_scope do |scope|
      scope.set_tags(my_tag: "my value")

      begin
        1 / 0
      rescue => e
        Sentry.capture_exception(e)
      end
    end

Originally posted by @sl0thentr0py in getsentry/sentry-docs#5328 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions