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 +4 -4
- data/lib/errorapp_notifier/notify.rb +9 -12
- data/lib/errorapp_notifier/version.rb +1 -1
- data/spec/errorapp_notifier/notify_spec.rb +13 -0
- 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: 26d615b0799422d7a3449d1ce0ec29a6bcd3308d
|
4
|
+
data.tar.gz: c34b497b8a47c06b1f5accee7f915efe6a0d42e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
14
|
-
|
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
|
-
|
20
|
-
|
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,
|
39
|
+
def notify_exception(exception, data)
|
43
40
|
if config.should_send_to_api?
|
44
|
-
notify!(
|
41
|
+
notify!(data)
|
45
42
|
else
|
46
43
|
raise exception
|
47
44
|
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.
|
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-
|
11
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|