Skip to content

Commit 07aaf5e

Browse files
authored
Don't throw error on arbitrary arguments being passed to capture_event options (#2301)
1 parent 0c06281 commit 07aaf5e

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

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

9+
### Bug Fixes
10+
11+
- Don't throw error on arbitrary arguments being passed to `capture_event` options [#2301](https://github.com/getsentry/sentry-ruby/pull/2301)
12+
- Fixes [#2299](https://github.com/getsentry/sentry-ruby/issues/2299)
13+
914
## 5.17.3
1015

1116
### Internal

sentry-ruby/lib/sentry/scope.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ def update_from_options(
135135
tags: nil,
136136
user: nil,
137137
level: nil,
138-
fingerprint: nil
138+
fingerprint: nil,
139+
**options
139140
)
140141
self.contexts.merge!(contexts) if contexts
141142
self.extra.merge!(extra) if extra

sentry-ruby/spec/sentry/scope_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,4 +336,30 @@
336336
subject.generate_propagation_context(env)
337337
end
338338
end
339+
340+
describe '#update_from_options' do
341+
it 'updates data from arguments' do
342+
subject.update_from_options(
343+
contexts: { context: 1 },
344+
extra: { foo: 42 },
345+
tags: { tag: 2 },
346+
user: { name: 'jane' },
347+
level: :info,
348+
fingerprint: 'ABCD'
349+
)
350+
351+
expect(subject.contexts).to include(context: 1)
352+
expect(subject.extra).to eq({ foo: 42 })
353+
expect(subject.tags).to eq({ tag: 2 })
354+
expect(subject.user).to eq({ name: 'jane' })
355+
expect(subject.level).to eq(:info)
356+
expect(subject.fingerprint).to eq('ABCD')
357+
end
358+
359+
it 'does not throw when arbitrary options passed' do
360+
expect do
361+
subject.update_from_options(foo: 42)
362+
end.not_to raise_error
363+
end
364+
end
339365
end

0 commit comments

Comments
 (0)