crashbreak 1.1.1 → 1.1.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d1f1c7eb6ca0bd51034cabec276b70ba903558e
|
4
|
+
data.tar.gz: c843d149874bc7e2bc655c08752502c59a822fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7956f81821bcc64ddecbc831f4d65df98e83e67f901be3c932c59b7a09ad18a699214df1d65dde60876d353ab9891be4190032f5d627b006a7e17a08cc40ff5
|
7
|
+
data.tar.gz: b1cf5cbff77eb3c24951518a3548543e3e70f2f550b848997e79d12a9245fe9016b43f2ca0c6fe67ad697147db87f9236593e3960a66d90d15429c7c0cafa5c8
|
@@ -2,6 +2,7 @@ module Crashbreak
|
|
2
2
|
class Configurator
|
3
3
|
attr_accessor :api_key
|
4
4
|
attr_accessor :ignored_environments
|
5
|
+
attr_accessor :ignored_exceptions
|
5
6
|
attr_accessor :exception_notifier
|
6
7
|
attr_accessor :error_serializers
|
7
8
|
attr_accessor :dumpers
|
@@ -27,6 +28,10 @@ module Crashbreak
|
|
27
28
|
@ignored_environments + ['test']
|
28
29
|
end
|
29
30
|
|
31
|
+
def ignored_exceptions
|
32
|
+
@ignored_exceptions ||= []
|
33
|
+
end
|
34
|
+
|
30
35
|
def error_serializers
|
31
36
|
@error_serializers ||= []
|
32
37
|
end
|
@@ -8,7 +8,7 @@ module Crashbreak
|
|
8
8
|
begin
|
9
9
|
@app.call(env)
|
10
10
|
rescue ::Exception => exception
|
11
|
-
unless skip_exception?
|
11
|
+
unless skip_exception?(exception)
|
12
12
|
RequestStore.store[:exception] = exception
|
13
13
|
store_variables_from_env env
|
14
14
|
exception_notifier.notify
|
@@ -33,8 +33,9 @@ module Crashbreak
|
|
33
33
|
Rack::Request.new(env)
|
34
34
|
end
|
35
35
|
|
36
|
-
def skip_exception?
|
37
|
-
Crashbreak.configure.ignored_environments.include?(ENV['RACK_ENV'] || ENV['RAILS_ENV'])
|
36
|
+
def skip_exception?(exception)
|
37
|
+
Crashbreak.configure.ignored_environments.include?(ENV['RACK_ENV'] || ENV['RAILS_ENV']) ||
|
38
|
+
Crashbreak.configure.ignored_exceptions.include?(exception.class)
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
data/lib/crashbreak/version.rb
CHANGED
@@ -33,24 +33,32 @@ describe Crashbreak::ExceptionCatcherMiddleware do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
context 'app that raises exception but
|
36
|
+
context 'app that raises exception but should be ignored' do
|
37
37
|
subject { described_class.new app_with_crashes }
|
38
38
|
|
39
39
|
before(:each) do
|
40
40
|
expect_any_instance_of(Crashbreak::ExceptionNotifier).to_not receive(:notify)
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
expect{ subject.call(env) }.to raise_error(error.class)
|
46
|
-
end
|
43
|
+
it 'skips development environment by default' do
|
44
|
+
expect(ENV).to receive(:[]).with('RACK_ENV').and_return('development')
|
47
45
|
|
48
|
-
|
49
|
-
|
46
|
+
expect{ subject.call(env) }.to raise_error(error.class)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'skips all environments in config' do
|
50
|
+
Crashbreak.configure.ignored_environments = ['staging']
|
51
|
+
expect(ENV).to receive(:[]).with('RACK_ENV').and_return('staging')
|
52
|
+
|
53
|
+
expect{ subject.call(env) }.to raise_error(error.class)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'skip all exception in config' do
|
57
|
+
allow(Crashbreak.configurator).to receive(:ignored_environments).and_return([])
|
58
|
+
Crashbreak.configure.ignored_exceptions = [error.class]
|
50
59
|
|
51
|
-
|
52
|
-
|
53
|
-
end
|
60
|
+
expect{ subject.call(env) }.to raise_error(error.class)
|
61
|
+
end
|
54
62
|
end
|
55
63
|
|
56
64
|
context 'app that works without exceptions' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crashbreak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Janeczek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|