bugsnag 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.6
1
+ 1.2.7
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "bugsnag"
8
- s.version = "1.2.6"
8
+ s.version = "1.2.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Smith"]
12
- s.date = "2012-12-02"
12
+ s.date = "2012-12-10"
13
13
  s.description = "Ruby notifier for bugsnag.com"
14
14
  s.email = "james@bugsnag.com"
15
15
  s.extra_rdoc_files = [
@@ -12,6 +12,8 @@ module Bugsnag
12
12
 
13
13
  API_KEY_REGEX = /[0-9a-f]{32}/i
14
14
 
15
+ MAX_EXCEPTIONS_TO_UNWRAP = 5
16
+
15
17
  # HTTParty settings
16
18
  headers "Content-Type" => "application/json"
17
19
  default_timeout 5
@@ -50,7 +52,7 @@ module Bugsnag
50
52
  # Unwrap exceptions
51
53
  @exceptions = []
52
54
  ex = exception
53
- while ex != nil
55
+ while ex != nil && !@exceptions.include?(ex) && @exceptions.length < MAX_EXCEPTIONS_TO_UNWRAP
54
56
  @exceptions << ex
55
57
 
56
58
  if ex.respond_to?(:continued_exception) && ex.continued_exception
@@ -3,6 +3,14 @@ require 'securerandom'
3
3
 
4
4
  module ActiveRecord; class RecordNotFound < RuntimeError; end; end
5
5
 
6
+ class RecursiveException < StandardError
7
+ attr_accessor :original_exception
8
+ def initialize(*args)
9
+ self.original_exception = self
10
+ super(message)
11
+ end
12
+ end
13
+
6
14
  describe Bugsnag::Notification do
7
15
  it "should contain an api_key if one is set" do
8
16
  Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
@@ -290,4 +298,26 @@ describe Bugsnag::Notification do
290
298
 
291
299
  Bugsnag.notify_or_ignore(BugsnagTestException.new("It crashed"))
292
300
  end
301
+
302
+ it "should not unwrap the same exception twice" do
303
+ Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
304
+ get_exception_from_payload(payload)
305
+ end
306
+
307
+ Bugsnag.notify_or_ignore(RecursiveException.new("Self-referential exception"))
308
+ end
309
+
310
+ it "should not unwrap more than 5 exceptions" do
311
+ Bugsnag::Notification.should_receive(:deliver_exception_payload) do |endpoint, payload|
312
+ event = get_event_from_payload(payload)
313
+ event[:exceptions].should have(5).items
314
+ end
315
+
316
+ first_ex = ex = RecursiveException.new("Deep exception")
317
+ 10.times do |idx|
318
+ ex = ex.original_exception = RecursiveException.new("Deep exception #{idx}")
319
+ end
320
+
321
+ Bugsnag.notify_or_ignore(first_ex)
322
+ end
293
323
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 6
10
- version: 1.2.6
9
+ - 7
10
+ version: 1.2.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-02 00:00:00 Z
18
+ date: 2012-12-10 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement