Skip to content

Commit

Permalink
Merge pull request #60 from Sija/develop
Browse files Browse the repository at this point in the history
v1.5.5
  • Loading branch information
Sija authored Dec 13, 2019
2 parents c046057 + 505dfe8 commit 5850245
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: raven
version: 1.5.4
version: 1.5.5

authors:
- Sijawusz Pur Rahnama <sija@sija.pl>
Expand All @@ -15,7 +15,7 @@ development_dependencies:
version: ~> 0.3.0
ameba:
github: crystal-ameba/ameba
version: ~> 0.10.0
version: ~> 0.11.0

targets:
crash_handler:
Expand Down
15 changes: 15 additions & 0 deletions spec/raven/instance_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ describe Raven::Instance do
end
end

{% for key in %i(user extra tags) %}
context "with {{key.id}} context specified" do
it "merges context hierarchy" do
with_instance do |instance|
Raven::Context.clear!
Raven.{{key.id}}_context(foo: :foo, bar: :bar)

instance.capture("Test message", {{key.id}}: {bar: "baz"}) do |event|
event.{{key.id}}.should eq({:foo => :foo, :bar => "baz"})
end
end
end
end
{% end %}

context "with String" do
it "sends the result of Event.from" do
with_instance do |instance|
Expand Down
5 changes: 2 additions & 3 deletions src/crash_handler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ module Raven
end

private def capture_with_options(*args, **options)
capture(*args) do |event|
event.initialize_with **DEFAULT_OPTS
event.initialize_with **options
options = DEFAULT_OPTS.merge(options)
capture(*args, **options) do |event|
yield event
end
end
Expand Down
8 changes: 6 additions & 2 deletions src/raven/instance.cr
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ module Raven
logger.debug "'#{obj}' excluded from capture: #{configuration.error_messages}"
return false
end
Event.from(obj, configuration: configuration, context: context).tap do |event|
event.initialize_with **options
default_options = {
configuration: configuration,
context: context,
}
options = default_options.merge(options)
Event.from(obj, **options).tap do |event|
hint =
if obj.is_a?(String)
Event::Hint.new(exception: nil, message: obj)
Expand Down
2 changes: 1 addition & 1 deletion src/raven/version.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Raven
VERSION = "1.5.4"
VERSION = "1.5.5"
end

0 comments on commit 5850245

Please sign in to comment.