dboard 1.0.5 → 1.1.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: 066c3ae2d4574bad0b7b56e0c5a784fe36b396d5
4
- data.tar.gz: 49aa1e783781c16fabee8416c2bdc97e9eceb0d1
3
+ metadata.gz: ba48cb0ffab690f4b38502e4bdf8f28d1e94422d
4
+ data.tar.gz: fc969a6e7516b14b8f4a222abde3db307f998a99
5
5
  SHA512:
6
- metadata.gz: 779322a76e7fd4521fc8c30cd6e394444e2ee25ee16849a7958a2fc04cb883f5d7c7b7e2dd32376f4edc51e4ac0a1ab6d146dc17e642defd532ae2e74bbbd319
7
- data.tar.gz: 14c30edbffe96773c1d783865e7e97581c286d06eff18c87c078d63c33eeca4c49dfbd1cc69591435fa0ca1e652d99021bd89b9dd1c73d724ceb208f8bb16074
6
+ metadata.gz: d4df321724dde11ae0227ba274290a71da77d01cf7655488016f2f95d8a12d790d7dd1cf3c35bddca804d292baa365cb412719da0253f3fa832033467d9dbda2
7
+ data.tar.gz: 1e7f06619130542469f208ffbc53ce86dc3f6d759f8c2040d7bac7c97bb1284766117f907f410645fa6d811a6d9b529df6b3be2d6768b4140d8fcf9e59d18579
@@ -15,6 +15,10 @@ module Dboard
15
15
  Collector.instance.register_after_update_callback(callback)
16
16
  end
17
17
 
18
+ def self.register_error_callback(callback)
19
+ Collector.instance.register_error_callback(callback)
20
+ end
21
+
18
22
  def self.start
19
23
  instance.start
20
24
  end
@@ -22,6 +26,7 @@ module Dboard
22
26
  def initialize
23
27
  @sources = {}
24
28
  @after_update_callback = lambda {}
29
+ @error_callback = lambda { |exception| }
25
30
  end
26
31
 
27
32
  def start
@@ -45,6 +50,10 @@ module Dboard
45
50
  @after_update_callback = callback
46
51
  end
47
52
 
53
+ def register_error_callback(callback)
54
+ @error_callback = callback
55
+ end
56
+
48
57
  # Public because the old tests depend on it
49
58
  def update_source(source, instance)
50
59
  begin
@@ -56,6 +65,7 @@ module Dboard
56
65
  rescue Exception => ex
57
66
  puts "Failed to update #{source}: #{ex.message}"
58
67
  puts ex.backtrace
68
+ @error_callback.call(ex)
59
69
  end
60
70
 
61
71
  private
@@ -1,3 +1,3 @@
1
1
  module Dboard
2
- VERSION = "1.0.5"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -25,6 +25,21 @@ describe Dboard::Collector, "register_source" do
25
25
  # since it is a singleton, and this callbacks leaks into the other tests
26
26
  Dboard::Collector.register_after_update_callback(lambda {})
27
27
  end
28
+
29
+ it "can register an error callback" do
30
+ new_relic = mock
31
+ error = RuntimeError.new("error")
32
+ new_relic.stub!(:fetch).and_raise(error)
33
+ callback = mock
34
+ Dboard::Collector.register_error_callback callback
35
+
36
+ callback.should_receive(:call).with(error)
37
+ Dboard::Publisher.stub!(:publish)
38
+ Dboard::Collector.instance.update_source(:new_relic, new_relic)
39
+
40
+ # since it is a singleton, and this callbacks leaks into the other tests
41
+ Dboard::Collector.register_error_callback(lambda { |_| })
42
+ end
28
43
  end
29
44
 
30
45
  describe Dboard::Collector, "update_source" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joakim Kolsjö
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty