denouncer 0.2.13 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/denouncer.rb +6 -0
- data/lib/denouncer/notifiers/base_notifier.rb +11 -0
- data/lib/denouncer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd7818d5f9f193ace4fca1390ba000808403fefe
|
4
|
+
data.tar.gz: 33a1d7791e3d04a59f62115e11eb1ff94e98f65b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f764ae4755bc8985a99cee4a19d2e0242c456b78be51b84d9ebbe74bab2b48e21eaf071dcb720a359bf295c728f556718062e6912f5cb02ac0c822100fddcab2
|
7
|
+
data.tar.gz: c601d4730d465d00eb6b4b76fd6d2e8d07b133062a7a43d7e56ea674e6bc404534c4ef124a0d3b0d1cc9812847cc48522d4217b837c3915290dbda5ff228ea87
|
data/README.md
CHANGED
@@ -124,7 +124,7 @@ Configuration variables are:
|
|
124
124
|
## Usage
|
125
125
|
|
126
126
|
The example below shows a basic usage pattern for denouncer notifications.
|
127
|
-
Catch exceptions, then use denouncer's notify function and
|
127
|
+
Catch exceptions, then use denouncer's notify function and then re-raise the error again.
|
128
128
|
|
129
129
|
begin
|
130
130
|
1/0
|
@@ -133,12 +133,24 @@ Catch exceptions, then use denouncer's notify function and the re-raise the erro
|
|
133
133
|
raise err
|
134
134
|
end
|
135
135
|
|
136
|
+
or
|
137
|
+
|
138
|
+
begin
|
139
|
+
1/0
|
140
|
+
rescue => err
|
141
|
+
Denouncer.notify! err, { test: "my metadata 1", test2: "my metadata 2" }
|
142
|
+
end
|
143
|
+
|
136
144
|
The metadata is optional and defaults to nil.
|
137
145
|
|
138
146
|
## Test Suite
|
139
147
|
|
140
148
|
bundle exec rspec
|
141
149
|
|
150
|
+
## Architecture overview
|
151
|
+
|
152
|
+
[This](https://docs.google.com/drawings/d/16DaQhsAwcr-5zlguhKGwigpdNpOgO4-IXssLst7zlUM/edit?usp=sharing) illustration shows the basic architecture of the denouncer gem.
|
153
|
+
|
142
154
|
## Contributing
|
143
155
|
|
144
156
|
1. Fork it ( https://github.com/[my-github-username]/denouncer/fork )
|
data/lib/denouncer.rb
CHANGED
@@ -38,6 +38,17 @@ module Denouncer
|
|
38
38
|
def notify(error, metadata = nil)
|
39
39
|
raise NotImplementedException("This method needs to be implemented in a sub-class!")
|
40
40
|
end
|
41
|
+
|
42
|
+
# Sends a notification
|
43
|
+
# raises the given error after notifying using the configured adapter
|
44
|
+
#
|
45
|
+
# @param error [StandardError]
|
46
|
+
# @param metadata [Hash]
|
47
|
+
# @raise [StandardError]
|
48
|
+
def notify!(error, metadata = nil)
|
49
|
+
notify error, metadata
|
50
|
+
raise error
|
51
|
+
end
|
41
52
|
end
|
42
53
|
end
|
43
54
|
end
|
data/lib/denouncer/version.rb
CHANGED