Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't throw error on arbitrary arguments being passed to capture_event options #2301

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

Rails users will be able to use `bin/rails generate sentry` to generate their `config/initializers/sentry.rb` file.

### Bug Fixes

- Don't throw error on arbitrary arguments being passed to `capture_event` options [#2301](https://github.com/getsentry/sentry-ruby/pull/2301)
- Fixes [#2299](https://github.com/getsentry/sentry-ruby/issues/2299)

## 5.17.3

### Internal
Expand Down
3 changes: 2 additions & 1 deletion sentry-ruby/lib/sentry/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def update_from_options(
tags: nil,
user: nil,
level: nil,
fingerprint: nil
fingerprint: nil,
**options
)
self.contexts.merge!(contexts) if contexts
self.extra.merge!(extra) if extra
Expand Down
26 changes: 26 additions & 0 deletions sentry-ruby/spec/sentry/scope_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,30 @@
subject.generate_propagation_context(env)
end
end

describe '#update_from_options' do
it 'updates data from arguments' do
subject.update_from_options(
contexts: { context: 1 },
extra: { foo: 42 },
tags: { tag: 2 },
user: { name: 'jane' },
level: :info,
fingerprint: 'ABCD'
)

expect(subject.contexts).to include(context: 1)
expect(subject.extra).to eq({ foo: 42 })
expect(subject.tags).to eq({ tag: 2 })
expect(subject.user).to eq({ name: 'jane' })
expect(subject.level).to eq(:info)
expect(subject.fingerprint).to eq('ABCD')
end

it 'does not throw when arbitrary options passed' do
expect do
subject.update_from_options(foo: 42)
end.not_to raise_error
end
end
end
Loading