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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f7c1f9cc8a7072f8f71b80eb1f6fea02e74d20c
4
- data.tar.gz: 465051f928dd370df5fffa886b677fe1e686205c
3
+ metadata.gz: dd7818d5f9f193ace4fca1390ba000808403fefe
4
+ data.tar.gz: 33a1d7791e3d04a59f62115e11eb1ff94e98f65b
5
5
  SHA512:
6
- metadata.gz: 15664ad3f6338b88a7209c81bfdaa837e5993e9c28243c32caf8b8021818b1c5f45770d2f10c928fda8d64968648d864f537be3f579e2d4d1165a7b0e4f1efd6
7
- data.tar.gz: 241110fb60a733e221d5d49d7191530b64dd214c5b8a635b94c26676f4f5d90227c90597fadc01704fa107dd32cfcf01f0fc37e852b4803180dc8fe7a1c3e357
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 the re-raise the error again.
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
@@ -55,6 +55,12 @@ module Denouncer
55
55
  end
56
56
  end
57
57
 
58
+ def self.notify!(error, metadata = nil)
59
+ if is_configured?
60
+ notifier.notify! error, metadata
61
+ end
62
+ end
63
+
58
64
  private
59
65
 
60
66
  def self.notifier
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Denouncer
2
- VERSION = "0.2.13"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: denouncer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Weber