rollbar 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +8 -2
- data/lib/rollbar/better_errors.rb +1 -1
- data/lib/rollbar/delayed_job.rb +1 -1
- data/lib/rollbar/exception_reporter.rb +1 -1
- data/lib/rollbar/goalie.rb +2 -2
- data/lib/rollbar/rake.rb +1 -1
- data/lib/rollbar/sidekiq.rb +2 -2
- data/lib/rollbar/version.rb +1 -1
- data/lib/rollbar.rb +10 -6
- data/spec/rollbar/delayed_job_spec.rb +5 -1
- data/spec/rollbar/middleware/rack/builder_spec.rb +1 -1
- data/spec/rollbar/middleware/sinatra_spec.rb +1 -1
- data/spec/rollbar/rake_spec.rb +1 -1
- data/spec/rollbar_bc_spec.rb +1 -1
- data/spec/rollbar_spec.rb +37 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7162276edce6487cb188a1ae5b7bacfd690f5f8f
|
4
|
+
data.tar.gz: d9f6433968083985d404cc46ce34d5607e46b7ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f689341a99194085a8f73f2e28c52dbce73ed44ad0bf9e81066cfd3aa7ca90e4a2ef071dd1c1e07ecb1ae80b6141f2fc5c901f7293baea0dfe64c048f4dec355
|
7
|
+
data.tar.gz: 447bfcd210fa8bd59eb05ee72cd53fa6a623019f76dd4c14eefd0e015c0a336e427b6f6dd7e432779199fc9fc76485c0cdd8cc1e4d7785b89d8fed5e11020889
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.4.0
|
4
|
+
|
5
|
+
Possible breaking changes:
|
6
|
+
|
7
|
+
- `exception_level_filters` is now applied only to "uncaught" errors (i.e. those detected by middlewares) but not to direct calls to `Rollbar.error`. If you were previously using `Rollbar.error` (or `Rollbar.warning`, etc.), the new behavior is *probably* desirable, but if it isn't, you can get the old behavior via `Rollbar.error(e, :use_exception_level_filters => true)`. The middlewares that ship with the gem also now pass this new flag.
|
8
|
+
|
3
9
|
## 1.3.2
|
4
10
|
|
5
11
|
Bug fixes:
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rollbar notifier for Ruby [](https://travis-ci.org/rollbar/rollbar-gem/branches)
|
2
2
|
|
3
3
|
<!-- RemoveNext -->
|
4
4
|
Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https://rollbar.com).
|
@@ -9,7 +9,7 @@ Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https:/
|
|
9
9
|
|
10
10
|
Add this line to your application's Gemfile:
|
11
11
|
|
12
|
-
gem 'rollbar', '~> 1.
|
12
|
+
gem 'rollbar', '~> 1.4.0'
|
13
13
|
|
14
14
|
And then execute:
|
15
15
|
|
@@ -294,6 +294,12 @@ By default, all uncaught exceptions are reported at the "error" level, except fo
|
|
294
294
|
|
295
295
|
If you'd like to customize this list, see the example code in ```config/initializers/rollbar.rb```. Supported levels: "critical", "error", "warning", "info", "debug", "ignore". Set to "ignore" to cause the exception not to be reported at all.
|
296
296
|
|
297
|
+
This behavior applies to uncaught exceptions, not direct calls to `Rollbar.error()`, `Rollbar.warning()`, etc. If you are making a direct call to one of the log methods and want exception level filters to apply, pass an extra keyword argument:
|
298
|
+
|
299
|
+
```ruby
|
300
|
+
Rollbar.error(exception, :use_exception_level_filters => true)
|
301
|
+
```
|
302
|
+
|
297
303
|
## Silencing exceptions at runtime
|
298
304
|
|
299
305
|
If you just want to disable exception reporting for a single block, use ```Rollbar.silenced```:
|
@@ -15,7 +15,7 @@ module BetterErrors
|
|
15
15
|
controller = env['action_controller.instance']
|
16
16
|
request_data = controller.rollbar_request_data rescue nil
|
17
17
|
person_data = controller.rollbar_person_data rescue nil
|
18
|
-
exception_data = Rollbar.scope(:request => request_data, :person => person_data).error(exception)
|
18
|
+
exception_data = Rollbar.scope(:request => request_data, :person => person_data).error(exception, :use_exception_level_filters => true)
|
19
19
|
rescue => e
|
20
20
|
Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e}"
|
21
21
|
end
|
data/lib/rollbar/delayed_job.rb
CHANGED
@@ -10,7 +10,7 @@ module Rollbar
|
|
10
10
|
rescue Exception => e
|
11
11
|
if job.attempts >= ::Rollbar.configuration.dj_threshold
|
12
12
|
data = ::Rollbar.configuration.report_dj_data ? job : nil
|
13
|
-
::Rollbar.scope(:request => data).error(e)
|
13
|
+
::Rollbar.scope(:request => data).error(e, :use_exception_level_filters => true)
|
14
14
|
end
|
15
15
|
raise e
|
16
16
|
end
|
@@ -4,7 +4,7 @@ module Rollbar
|
|
4
4
|
exception_message = exception.respond_to?(:message) ? exception.message : 'No Exception Message'
|
5
5
|
Rollbar.log_debug "[Rollbar] Reporting exception: #{exception_message}"
|
6
6
|
|
7
|
-
exception_data = Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception)
|
7
|
+
exception_data = Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception, :use_exception_level_filters => true)
|
8
8
|
|
9
9
|
if exception_data.is_a?(Hash)
|
10
10
|
env['rollbar.exception_uuid'] = exception_data[:uuid]
|
data/lib/rollbar/goalie.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Goalie
|
2
2
|
class CustomErrorPages
|
3
3
|
alias_method :orig_render_exception, :render_exception
|
4
|
-
|
4
|
+
|
5
5
|
private
|
6
6
|
|
7
7
|
def render_exception(env, exception)
|
@@ -10,7 +10,7 @@ module Goalie
|
|
10
10
|
controller = env['action_controller.instance']
|
11
11
|
request_data = controller.rollbar_request_data rescue nil
|
12
12
|
person_data = controller.rollbar_person_data rescue nil
|
13
|
-
exception_data = Rollbar.scope(:request => request_data, :person => person_data).error(exception)
|
13
|
+
exception_data = Rollbar.scope(:request => request_data, :person => person_data).error(exception, :use_exception_level_filters => true)
|
14
14
|
rescue => e
|
15
15
|
Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e}"
|
16
16
|
end
|
data/lib/rollbar/rake.rb
CHANGED
data/lib/rollbar/sidekiq.rb
CHANGED
@@ -12,7 +12,7 @@ if Sidekiq::VERSION < '3'
|
|
12
12
|
params = msg.reject{ |k| PARAM_BLACKLIST.include?(k) }
|
13
13
|
scope = { :request => { :params => params } }
|
14
14
|
|
15
|
-
Rollbar.scope(scope).error(e)
|
15
|
+
Rollbar.scope(scope).error(e, :use_exception_level_filters => true)
|
16
16
|
raise
|
17
17
|
end
|
18
18
|
end
|
@@ -30,7 +30,7 @@ else
|
|
30
30
|
params = context.reject{ |k| PARAM_BLACKLIST.include?(k) }
|
31
31
|
scope = { :request => { :params => params } }
|
32
32
|
|
33
|
-
Rollbar.scope(scope).error(e)
|
33
|
+
Rollbar.scope(scope).error(e, :use_exception_level_filters => true)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/rollbar/version.rb
CHANGED
data/lib/rollbar.rb
CHANGED
@@ -125,10 +125,14 @@ module Rollbar
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
|
128
|
+
use_exception_level_filters = extra && extra.delete(:use_exception_level_filters) == true
|
129
129
|
|
130
|
-
|
131
|
-
|
130
|
+
return 'ignored' if ignored?(exception, use_exception_level_filters)
|
131
|
+
|
132
|
+
if use_exception_level_filters
|
133
|
+
exception_level = filtered_level(exception)
|
134
|
+
level = exception_level if exception_level
|
135
|
+
end
|
132
136
|
|
133
137
|
begin
|
134
138
|
report(level, message, exception, extra)
|
@@ -193,9 +197,9 @@ module Rollbar
|
|
193
197
|
|
194
198
|
private
|
195
199
|
|
196
|
-
def ignored?(exception)
|
200
|
+
def ignored?(exception, use_exception_level_filters = false)
|
197
201
|
return false unless exception
|
198
|
-
return true if filtered_level(exception) == 'ignore'
|
202
|
+
return true if use_exception_level_filters && filtered_level(exception) == 'ignore'
|
199
203
|
return true if exception.instance_variable_get(:@_rollbar_do_not_report)
|
200
204
|
|
201
205
|
false
|
@@ -762,7 +766,7 @@ module Rollbar
|
|
762
766
|
scope[:person] = person_data if person_data
|
763
767
|
|
764
768
|
Rollbar.scoped(scope) do
|
765
|
-
Rollbar.notifier.log(level, exception)
|
769
|
+
Rollbar.notifier.log(level, exception, :use_exception_level_filters => true)
|
766
770
|
end
|
767
771
|
end
|
768
772
|
|
@@ -32,8 +32,12 @@ describe Rollbar::Delayed, :reconfigure_notifier => true do
|
|
32
32
|
Delayed::Worker.backend = DummyBackend::Job
|
33
33
|
end
|
34
34
|
|
35
|
+
let(:expected_args) do
|
36
|
+
[kind_of(FailingJob::TestException), { :use_exception_level_filters => true}]
|
37
|
+
end
|
38
|
+
|
35
39
|
it 'sends the exception' do
|
36
|
-
expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(
|
40
|
+
expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(*expected_args)
|
37
41
|
|
38
42
|
expect do
|
39
43
|
Delayed::Job.enqueue(FailingJob.new)
|
@@ -26,7 +26,7 @@ describe Rollbar::Middleware::Rack::Builder, :reconfigure_notifier => true do
|
|
26
26
|
let(:uncaught_level) { Rollbar.configuration.uncaught_exception_level }
|
27
27
|
|
28
28
|
it 'reports the error to Rollbar' do
|
29
|
-
expect(Rollbar).to receive(:log).with(uncaught_level, exception)
|
29
|
+
expect(Rollbar).to receive(:log).with(uncaught_level, exception, :use_exception_level_filters => true)
|
30
30
|
expect { request.get('/will_crash') }.to raise_error(exception)
|
31
31
|
end
|
32
32
|
|
data/spec/rollbar/rake_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Rollbar::Rake do
|
|
12
12
|
|
13
13
|
it 'reports error to Rollbar' do
|
14
14
|
expect(Rollbar::Rake).not_to receive(:skip_patch)
|
15
|
-
expect(Rollbar).to receive(:error).with(exception)
|
15
|
+
expect(Rollbar).to receive(:error).with(exception, :use_exception_level_filters => true)
|
16
16
|
expect(application).to receive(:orig_display_error_message).with(exception)
|
17
17
|
|
18
18
|
Rollbar::Rake.patch! # Really here Rake is already patched
|
data/spec/rollbar_bc_spec.rb
CHANGED
@@ -276,7 +276,7 @@ describe Rollbar do
|
|
276
276
|
Rollbar.last_report.should_not be_nil
|
277
277
|
end
|
278
278
|
|
279
|
-
it 'should allow callables to set exception filtered level' do
|
279
|
+
it 'should allow callables to set exception filtered level with :use_exception_level_filters option' do
|
280
280
|
callable_mock = double
|
281
281
|
Rollbar.configure do |config|
|
282
282
|
config.exception_level_filters = { 'NameError' => callable_mock }
|
data/spec/rollbar_spec.rb
CHANGED
@@ -731,25 +731,48 @@ describe Rollbar do
|
|
731
731
|
Rollbar.error(exception).should == 'disabled'
|
732
732
|
end
|
733
733
|
|
734
|
-
|
735
|
-
|
736
|
-
|
734
|
+
context 'using :use_exception_level_filters option as true' do
|
735
|
+
it 'sends the correct filtered level' do
|
736
|
+
Rollbar.configure do |config|
|
737
|
+
config.exception_level_filters = { 'NameError' => 'warning' }
|
738
|
+
end
|
739
|
+
|
740
|
+
Rollbar.error(exception, :use_exception_level_filters => true)
|
741
|
+
expect(Rollbar.last_report[:level]).to be_eql('warning')
|
737
742
|
end
|
738
743
|
|
739
|
-
|
740
|
-
|
741
|
-
|
744
|
+
it 'ignore ignored exception classes' do
|
745
|
+
Rollbar.configure do |config|
|
746
|
+
config.exception_level_filters = { 'NameError' => 'ignore' }
|
747
|
+
end
|
742
748
|
|
743
|
-
|
749
|
+
logger_mock.should_not_receive(:info)
|
750
|
+
logger_mock.should_not_receive(:warn)
|
751
|
+
logger_mock.should_not_receive(:error)
|
752
|
+
|
753
|
+
Rollbar.error(exception, :use_exception_level_filters => true)
|
754
|
+
end
|
744
755
|
end
|
745
756
|
|
746
|
-
|
747
|
-
|
748
|
-
|
757
|
+
context 'if not using :use_exception_level_filters option' do
|
758
|
+
it 'sends the level defined by the used method' do
|
759
|
+
Rollbar.configure do |config|
|
760
|
+
config.exception_level_filters = { 'NameError' => 'warning' }
|
761
|
+
end
|
762
|
+
|
763
|
+
Rollbar.error(exception)
|
764
|
+
expect(Rollbar.last_report[:level]).to be_eql('error')
|
749
765
|
end
|
750
766
|
|
751
|
-
|
752
|
-
|
767
|
+
it 'ignore ignored exception classes' do
|
768
|
+
Rollbar.configure do |config|
|
769
|
+
config.exception_level_filters = { 'NameError' => 'ignore' }
|
770
|
+
end
|
771
|
+
|
772
|
+
Rollbar.error(exception)
|
773
|
+
|
774
|
+
expect(Rollbar.last_report[:level]).to be_eql('error')
|
775
|
+
end
|
753
776
|
end
|
754
777
|
|
755
778
|
it "should work with an IO object as rack.errors" do
|
@@ -813,6 +836,7 @@ describe Rollbar do
|
|
813
836
|
it 'should allow callables to set exception filtered level' do
|
814
837
|
callable_mock = double
|
815
838
|
saved_filters = Rollbar.configuration.exception_level_filters
|
839
|
+
|
816
840
|
Rollbar.configure do |config|
|
817
841
|
config.exception_level_filters = { 'NameError' => callable_mock }
|
818
842
|
end
|
@@ -822,7 +846,7 @@ describe Rollbar do
|
|
822
846
|
logger_mock.should_not_receive(:warn)
|
823
847
|
logger_mock.should_not_receive(:error)
|
824
848
|
|
825
|
-
Rollbar.error(exception)
|
849
|
+
Rollbar.error(exception, :use_exception_level_filters => true)
|
826
850
|
end
|
827
851
|
|
828
852
|
it 'should not report exceptions when silenced' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rollbar, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|