Skip to content

Commit 526762e

Browse files
committed
Merge pull request #319 from eagletmt/symbolized-keys
Fix event hash lookup
2 parents 7fe61c2 + fe35477 commit 526762e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/raven/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def send(event)
3232
return
3333
end
3434

35-
Raven.logger.debug "Sending event #{event['id']} to Sentry"
35+
Raven.logger.debug "Sending event #{event[:event_id]} to Sentry"
3636

3737
content_type, encoded_data = encode(event)
3838

@@ -73,7 +73,7 @@ def encode(event)
7373
end
7474

7575
def get_log_message(event)
76-
(event && event['message']) || '<no message value>'
76+
(event && event[:message]) || '<no message value>'
7777
end
7878

7979
def transport

spec/raven/integration_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
88
stub.post('sentry/api/42/store/') { [200, {}, 'ok'] }
99
end
10+
io = StringIO.new
1011

1112
Raven.configure do |config|
1213
config.server = 'http://12345:[email protected]/sentry/42'
1314
config.environments = ["test"]
1415
config.current_environment = "test"
1516
config.http_adapter = [:test, stubs]
17+
config.logger = Logger.new(io)
1618
end
1719

1820
Raven.capture_exception(build_exception)
1921

2022
stubs.verify_stubbed_calls
2123

24+
expect(io.string).to match(/Sending event [0-9a-f]+ to Sentry$/)
2225
end
2326

2427
example "posting an exception to a prefixed DSN" do
@@ -60,17 +63,20 @@
6063
end
6164

6265
example "timed backoff should prevent sends" do
66+
io = StringIO.new
6367
Raven.configure do |config|
6468
config.server = 'http://12345:[email protected]/sentry/42'
6569
config.environments = ["test"]
6670
config.current_environment = "test"
6771
config.http_adapter = [:test, nil]
72+
config.logger = Logger.new(io)
6873
end
6974

7075
expect_any_instance_of(Raven::Transports::HTTP).to receive(:send).exactly(1).times.and_raise(Faraday::Error::ConnectionFailed, "conn failed")
7176
expect { Raven.capture_exception(build_exception) }.not_to raise_error
7277

7378
expect(Raven.logger).to receive(:error).exactly(1).times
7479
expect { Raven.capture_exception(build_exception) }.not_to raise_error
80+
expect(io.string).to match(/Failed to submit event: ZeroDivisionError: divided by 0$/)
7581
end
7682
end

0 commit comments

Comments
 (0)