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: a1d14fcb61e329935dd1f837590f346da64245a4
4
- data.tar.gz: 1446a4ac170233144972b04d3847c0a00946df74
3
+ metadata.gz: 3d1f1c7eb6ca0bd51034cabec276b70ba903558e
4
+ data.tar.gz: c843d149874bc7e2bc655c08752502c59a822fff
5
5
  SHA512:
6
- metadata.gz: 0b87d86b0de848dbbbee95e99bee32c8056935bcae23ad000087febc354681a426825854ca4d988dc73c999c5abe1d42d0e17c2ee4732c8bcb239d753cdeab17
7
- data.tar.gz: 22dacbe1ce5b36120300cd849ae4aba0fc4a81665e8585f8c57c623f03f2619ca56f28369c1a4bc928563ab15741d8d65aeaa42ac959c521f5e17292bce5aa9d
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
@@ -1,3 +1,3 @@
1
1
  module Crashbreak
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -33,24 +33,32 @@ describe Crashbreak::ExceptionCatcherMiddleware do
33
33
  end
34
34
  end
35
35
 
36
- context 'app that raises exception but current env is ignored' do
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
- it 'skips development environment by default' do
44
- expect(ENV).to receive(:[]).with('RACK_ENV').and_return('development')
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
- it 'skips all environments in config' do
49
- Crashbreak.configure.ignored_environments = ['staging']
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
- expect(ENV).to receive(:[]).with('RACK_ENV').and_return('staging')
52
- expect{ subject.call(env) }.to raise_error(error.class)
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.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-16 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler