failbot 0.9.5 → 0.9.6

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: d3383e57149a6965ae7803d6170a66dd65f2932d
4
- data.tar.gz: 08940607fb5553f0641fc35f55a8b019e185a571
3
+ metadata.gz: 535bea1efe92287487fb8eca35fa79362b5a3467
4
+ data.tar.gz: 6e95a3258b3778cb4c832201431685fed770051f
5
5
  SHA512:
6
- metadata.gz: fd26e1e21ee3d9f5d8b6352302d26678d1b40d0c86138fd8e509bc92d5e5aa4ee966adca191924b867228b25a0a9a81a9c39964869dc6154bc435c74aeb272c5
7
- data.tar.gz: 90ef4318bad3829e2018f7832e288c62fdb3d3b1e1f61da138c1767870969271f242a759550a69f822d2ea74703ce54ef57f42d1d7e855de97f4f51b1278273c
6
+ metadata.gz: 837e0d280e169632d08e79fb3f5703278f622a43fc7dbc3c36dec172d7fe8b46f90fa92d9634c8e2289186f1c7e0ccc218cae974931798c0f5002d833654e6a2
7
+ data.tar.gz: 75dd783805b131deda512d0234fa08a517e9482751aac30b2cdc5c05ad142430bde3531f6f749c2da451c089f815b24a3502122e9a1acd1ef527dc4ad190b77d
@@ -24,6 +24,9 @@ module Failbot
24
24
  autoload :MemoryBackend, 'failbot/memory_backend'
25
25
  autoload :JSONBackend, 'failbot/json_backend'
26
26
 
27
+ # prevent recursive calls to Failbot.report!
28
+ attr_accessor :already_reporting
29
+
27
30
  # Public: Setup the backend for reporting exceptions.
28
31
  def setup(settings={}, default_context={})
29
32
  deprecated_settings = %w[
@@ -124,6 +127,15 @@ module Failbot
124
127
 
125
128
  def report!(e, other = {})
126
129
  data = squash_context(exception_info(e), other)
130
+
131
+ if already_reporting
132
+ logger.warn "FAILBOT: asked to report while reporting! #{data.inspect}" rescue nil
133
+ logger.warn e.message rescue nil
134
+ logger.warn e.backtrace.join("\n") rescue nil
135
+ return
136
+ end
137
+
138
+ self.already_reporting = true
127
139
  backend.report(data)
128
140
  rescue Object => i
129
141
  # don't fail for any reason
@@ -132,6 +144,8 @@ module Failbot
132
144
  logger.debug e.backtrace.join("\n") rescue nil
133
145
  logger.debug i.message rescue nil
134
146
  logger.debug i.backtrace.join("\n") rescue nil
147
+ ensure
148
+ self.already_reporting = false
135
149
  end
136
150
 
137
151
  # Public: exceptions that were reported. Only available when using the
@@ -186,6 +200,10 @@ module Failbot
186
200
  'created_at' => Time.now.utc.iso8601(6)
187
201
  }
188
202
 
203
+ if exception_context = (e.respond_to?(:failbot_context) && e.failbot_context)
204
+ res.merge!(exception_context)
205
+ end
206
+
189
207
  if original = (e.respond_to?(:original_exception) && e.original_exception)
190
208
  remote_backtrace = []
191
209
  remote_backtrace << original.message
@@ -26,13 +26,17 @@ module Failbot
26
26
  end
27
27
 
28
28
  # make request
29
- req = Net::HTTP.new(@url.host, @url.port)
29
+ http = Net::HTTP.new(@url.host, @url.port)
30
30
 
31
31
  # use SSL if applicable
32
- req.use_ssl = true if @url.scheme == "https"
32
+ http.use_ssl = true if @url.scheme == "https"
33
33
 
34
34
  # push it through
35
- req.start { |http| http.request(post) }
35
+ response = http.request(post)
36
+
37
+ # Raise if the exception doesn't make it to Haystack, ensures the failure
38
+ # is logged
39
+ raise StandardError, "couldn't send exception to Haystack" unless response.code == "201"
36
40
  end
37
41
 
38
42
  def self.send_data(data)
@@ -1,3 +1,3 @@
1
1
  module Failbot
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: failbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - '@rtomayko'
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-29 00:00:00.000000000 Z
13
+ date: 2014-08-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: yajl-ruby