errorapp_notifier 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73aabada015e5a366a71f919330dbda250a796b6
4
- data.tar.gz: 81180c1a660b66aa8e2968245bef973665fdabb4
3
+ metadata.gz: 26d615b0799422d7a3449d1ce0ec29a6bcd3308d
4
+ data.tar.gz: c34b497b8a47c06b1f5accee7f915efe6a0d42e2
5
5
  SHA512:
6
- metadata.gz: 454ba40d8c73c1cdd81a1081c77e221bf41884ccd3b3afa0024daecb15882199635ec80622338a0eb9e3bb64e383b27dc83b9e0ffd178381f188a5e63cb400c8
7
- data.tar.gz: 7bf777670b0e10f70c8dfdb2ea1ba5ca29453f28b7ed35adbacf52b42b46e2758637042275d20de4a9a016fe3b3061fd7b90702ce7e569264336c87b96c7d58c
6
+ metadata.gz: f5b8b4fc273534027f02f4985b7f6326b52ee7cf5d862590f808ead32659162e29546ff80a7e86d0c3ff3b43b96cb18aa50ad8842a75a784fa38f0119ffcc2ae
7
+ data.tar.gz: df8d45f77120650a3f3c3e97c4d2df9ee5566a527ca6b45815b262c2bb581a45f5598b89e562bd14555c545861f196863cd8d68c0c70b7c120b76ccbfd8e07e1
@@ -2,23 +2,20 @@ module ErrorappNotifier
2
2
  class Notify
3
3
  class << self
4
4
  def notify_with_controller(exception, controller = nil, request = nil)
5
- notify_exception(exception) do
6
- if !ignore?(exception, request)
7
- ControllerFailureData.new(exception, controller, request)
8
- end
5
+ data = ControllerFailureData.new(exception, controller, request)
6
+ if data && !ignore?(exception, request)
7
+ notify_exception(exception, data)
9
8
  end
10
9
  end
11
10
 
12
11
  def notify_with_rack(exception, environment, request)
13
- notify_exception(exception) do
14
- RackFailureData.new(exception, environment, request)
15
- end
12
+ data = RackFailureData.new(exception, environment, request)
13
+ notify_exception(exception, data)
16
14
  end
17
15
 
18
16
  def notify(exception, name = nil)
19
- notify_exception(exception) do
20
- FailureData.new(exception, name)
21
- end
17
+ data = FailureData.new(exception, name)
18
+ notify_exception(exception, data)
22
19
  end
23
20
 
24
21
  def ignore?(exception, request)
@@ -39,9 +36,9 @@ module ErrorappNotifier
39
36
 
40
37
  private
41
38
 
42
- def notify_exception(exception, &block)
39
+ def notify_exception(exception, data)
43
40
  if config.should_send_to_api?
44
- notify!(yield)
41
+ notify!(data)
45
42
  else
46
43
  raise exception
47
44
  end
@@ -1,3 +1,3 @@
1
1
  module ErrorappNotifier
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -34,6 +34,19 @@ describe ErrorappNotifier::Notify do
34
34
  ErrorappNotifier::Notifier.should_receive(:notify_error).with(data)
35
35
  ErrorappNotifier::Notify.notify_with_controller(*args)
36
36
  end
37
+
38
+ it "should not notify if ignored" do
39
+ @config.ignore_exceptions = ['IgnoreMe']
40
+ exception = double('exception', class: 'IgnoreMe')
41
+ controller = double('controller')
42
+ request = double('request')
43
+ args = [exception, controller, request]
44
+ data = double("data")
45
+
46
+ ErrorappNotifier::ControllerFailureData.should_receive(:new).with(*args).and_return(data)
47
+ ErrorappNotifier::Notifier.should_not_receive(:notify_error).with(data)
48
+ ErrorappNotifier::Notify.notify_with_controller(*args)
49
+ end
37
50
  end
38
51
 
39
52
  describe "#notify_with_rack" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errorapp_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rashmi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-04 00:00:00.000000000 Z
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler