bugsnag 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0521fc3cace95079dc4d038dc75c02481ba7847b
4
- data.tar.gz: 1d34bcc368eb9e4fc6b04a15ccd31e6ec3db2380
3
+ metadata.gz: 0293abdf77561e74847883fc613ca6dc008cebab
4
+ data.tar.gz: 619d14f7854cfc80f580d3d02737f1df3e67b661
5
5
  SHA512:
6
- metadata.gz: 5a2fbdbd810edc36b0ca20ac6e44dbd61c59cccd3ad96cb53e8b8da49ea38e6010e9969e4d34096f58e53892faf061a1b81af677fe937fa7fa3609af566c06f1
7
- data.tar.gz: e48a77338ef9d1ec47e277aa40e8ac84dadbecdb688938531b9f508dba39b242ebce72a0999a387bd08e0a82201acc08148a99b63db1fdf83ce5a37ec7ef5f81
6
+ metadata.gz: cf05cd8421771e2af00139da267a9bdb3f29104d1cc9b20974db805677582676289e5f2ffaf8248ca4d9b660aa879b0099a85fbdc1e0709859d26b6da170f0b3
7
+ data.tar.gz: f3b7696c70a8eedf524ab3a8bfdac71a0e6dfd8f3c823270a51f7a3f1a20c46321cfdf4e03a3490193e8ad7e9c3b0071f81e2e78f1d04208eda214945a65c1d3
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 2.4.1
5
+ ------
6
+
7
+ - Ensure filtering behaviour matches rails' for symbol filters
8
+ - Fix Rails 4 sessions appearing in Custom tab instead of its own ([144](https://github.com/bugsnag/bugsnag-ruby/issues/144))
9
+
4
10
  2.4.0
5
11
  -----
6
12
  - Allow filters to be regular expressions (thanks @tamird)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.4.1
@@ -39,7 +39,15 @@ module Bugsnag::Middleware
39
39
  notification.add_tab(:environment, env)
40
40
 
41
41
  # Add a session tab
42
- notification.add_tab(:session, session) if session
42
+ if session
43
+ if session.is_a?(Hash)
44
+ # Rails 3
45
+ notification.add_tab(:session, session)
46
+ elsif session.respond_to?(:to_hash)
47
+ # Rails 4
48
+ notification.add_tab(:session, session.to_hash)
49
+ end
50
+ end
43
51
 
44
52
  # Add a cookies tab
45
53
  cookies = request.cookies
@@ -4,13 +4,13 @@ module Bugsnag
4
4
  @middlewares = []
5
5
  @disabled_middleware = []
6
6
  end
7
-
7
+
8
8
  def use(new_middleware)
9
9
  return if @disabled_middleware.include?(new_middleware)
10
10
 
11
11
  @middlewares << new_middleware
12
12
  end
13
-
13
+
14
14
  def insert_after(after, new_middleware)
15
15
  return if @disabled_middleware.include?(new_middleware)
16
16
 
@@ -26,7 +26,7 @@ module Bugsnag
26
26
  @middlewares.insert index + 1, new_middleware
27
27
  end
28
28
  end
29
-
29
+
30
30
  def insert_before(before, new_middleware)
31
31
  return if @disabled_middleware.include?(new_middleware)
32
32
 
@@ -38,7 +38,7 @@ module Bugsnag
38
38
 
39
39
  @middlewares.insert index || @middlewares.length, new_middleware
40
40
  end
41
-
41
+
42
42
  def disable(*middlewares)
43
43
  @disabled_middleware += middlewares
44
44
 
@@ -49,19 +49,19 @@ module Bugsnag
49
49
  def method_missing(method, *args, &block)
50
50
  @middlewares.send(method, *args, &block)
51
51
  end
52
-
53
- # Runs the middleware stack and calls
52
+
53
+ # Runs the middleware stack and calls
54
54
  def run(notification)
55
55
  # The final lambda is the termination of the middleware stack. It calls deliver on the notification
56
56
  lambda_has_run = false
57
- notify_lambda = lambda do |notification|
58
- lambda_has_run = true
57
+ notify_lambda = lambda do |notif|
58
+ lambda_has_run = true
59
59
  yield
60
60
  end
61
61
 
62
62
  begin
63
63
  # We reverse them, so we can call "call" on the first middleware
64
- middleware_procs.reverse.inject(notify_lambda) { |n,e| e[n] }.call(notification)
64
+ middleware_procs.reverse.inject(notify_lambda) { |n,e| e.call(n) }.call(notification)
65
65
  rescue StandardError => e
66
66
  # KLUDGE: Since we don't re-raise middleware exceptions, this breaks rspec
67
67
  raise if e.class.to_s == "RSpec::Expectations::ExpectationNotMetError"
@@ -71,7 +71,7 @@ module Bugsnag
71
71
  Bugsnag.warn "Bugsnag middleware error: #{e}"
72
72
  Bugsnag.log "Middleware error stacktrace: #{e.backtrace.inspect}"
73
73
  end
74
-
74
+
75
75
  # Ensure that the deliver has been performed, and no middleware has botched it
76
76
  notify_lambda.call(notification) unless lambda_has_run
77
77
  end
@@ -83,4 +83,4 @@ module Bugsnag
83
83
  @middlewares.map{|middleware| proc { |next_middleware| middleware.new(next_middleware) } }
84
84
  end
85
85
  end
86
- end
86
+ end
@@ -77,6 +77,7 @@ module Bugsnag
77
77
  @request_data = request_data
78
78
  @meta_data = {}
79
79
  @user = {}
80
+ @should_ignore = false
80
81
 
81
82
  self.severity = @overrides[:severity]
82
83
  @overrides.delete :severity
@@ -93,6 +94,7 @@ module Bugsnag
93
94
 
94
95
  # Unwrap exceptions
95
96
  @exceptions = []
97
+
96
98
  ex = exception
97
99
  while ex != nil && !@exceptions.include?(ex) && @exceptions.length < MAX_EXCEPTIONS_TO_UNWRAP
98
100
 
@@ -213,6 +215,10 @@ module Bugsnag
213
215
 
214
216
  # Run the middleware here, at the end of the middleware stack, execute the actual delivery
215
217
  @configuration.middleware.run(self) do
218
+ # At this point the callbacks have already been run.
219
+ # This supports self.ignore! for before_notify_callbacks.
220
+ return if @should_ignore
221
+
216
222
  # Now override the required fields
217
223
  exceptions.each do |exception|
218
224
  if exception.class.include?(Bugsnag::MetaData)
@@ -270,7 +276,7 @@ module Bugsnag
270
276
  end
271
277
 
272
278
  def ignore?
273
- ignore_exception_class? || ignore_user_agent?
279
+ @should_ignore || ignore_exception_class? || ignore_user_agent?
274
280
  end
275
281
 
276
282
  def request_data
@@ -281,11 +287,14 @@ module Bugsnag
281
287
  @exceptions
282
288
  end
283
289
 
290
+ def ignore!
291
+ @should_ignore = true
292
+ end
293
+
284
294
  private
285
295
 
286
296
  def ignore_exception_class?
287
297
  @exceptions.any? do |ex|
288
- ex_name = error_class(ex)
289
298
  ancestor_chain = ex.class.ancestors.select { |ancestor| ancestor.is_a?(Class) }.map { |ancestor| error_class(ancestor) }.to_set
290
299
 
291
300
  @configuration.ignore_classes.any? do |to_ignore|
@@ -20,7 +20,7 @@ module Bugsnag
20
20
  config.project_root = Rails.root.to_s
21
21
  config.params_filters += Rails.configuration.filter_parameters.map do |filter|
22
22
  case filter
23
- when String
23
+ when String, Symbol
24
24
  /\A#{filter}\z/
25
25
  else
26
26
  filter
@@ -8,7 +8,7 @@ describe Bugsnag::MiddlewareStack do
8
8
  expect(event[:metaData][:some_tab][:info]).to eq("here")
9
9
  expect(event[:metaData][:some_tab][:data]).to eq("also here")
10
10
  end
11
-
11
+
12
12
  callback_run_count = 0
13
13
  Bugsnag.before_notify_callbacks << lambda {|notif|
14
14
  notif.add_tab(:some_tab, {
@@ -21,7 +21,7 @@ describe Bugsnag::MiddlewareStack do
21
21
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
22
22
  expect(callback_run_count).to eq(1)
23
23
  end
24
-
24
+
25
25
  it "runs before_bugsnag_notify callbacks, adding custom data" do
26
26
  expect(Bugsnag::Notification).to receive(:deliver_exception_payload) do |endpoint, payload|
27
27
  event = get_event_from_payload(payload)
@@ -29,12 +29,12 @@ describe Bugsnag::MiddlewareStack do
29
29
  expect(event[:metaData][:custom][:info]).to eq("here")
30
30
  expect(event[:metaData][:custom][:data]).to eq("also here")
31
31
  end
32
-
32
+
33
33
  callback_run_count = 0
34
34
  Bugsnag.before_notify_callbacks << lambda {|notif|
35
35
  notif.add_custom_data(:info, "here")
36
36
  notif.add_custom_data(:data, "also here")
37
-
37
+
38
38
  callback_run_count += 1
39
39
  }
40
40
 
@@ -51,7 +51,7 @@ describe Bugsnag::MiddlewareStack do
51
51
  expect(event[:user][:name]).to eq("also here too")
52
52
  expect(event[:user][:random_key]).to eq("also here too too")
53
53
  end
54
-
54
+
55
55
  callback_run_count = 0
56
56
  Bugsnag.before_notify_callbacks << lambda {|notif|
57
57
  notif.user = {:id => "here", :email => "also here", :name => "also here too", :random_key => "also here too too"}
@@ -61,7 +61,7 @@ describe Bugsnag::MiddlewareStack do
61
61
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
62
62
  expect(callback_run_count).to eq(1)
63
63
  end
64
-
64
+
65
65
  it "overrides data set in before_notify" do
66
66
  expect(Bugsnag::Notification).to receive(:deliver_exception_payload) do |endpoint, payload|
67
67
  event = get_event_from_payload(payload)
@@ -69,40 +69,40 @@ describe Bugsnag::MiddlewareStack do
69
69
  expect(event[:metaData][:custom][:info]).to eq("here2")
70
70
  expect(event[:metaData][:custom][:data]).to eq("also here")
71
71
  end
72
-
72
+
73
73
  callback_run_count = 0
74
74
  Bugsnag.before_notify_callbacks << lambda {|notif|
75
75
  notif.add_custom_data(:info, "here")
76
76
  notif.add_custom_data(:data, "also here")
77
-
77
+
78
78
  callback_run_count += 1
79
79
  }
80
80
 
81
81
  Bugsnag.notify(BugsnagTestException.new("It crashed"), {:info => "here2"})
82
82
  expect(callback_run_count).to eq(1)
83
83
  end
84
-
84
+
85
85
  it "does not have have before or after callbacks by default" do
86
86
  expect(Bugsnag::Notification).to receive(:deliver_exception_payload) do |endpoint, payload|
87
87
  event = get_event_from_payload(payload)
88
88
  expect(event[:metaData].size).to eq(0)
89
89
  end
90
-
90
+
91
91
  expect(Bugsnag.before_notify_callbacks.size).to eq(0)
92
92
  expect(Bugsnag.after_notify_callbacks.size).to eq(0)
93
93
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
94
94
  end
95
-
95
+
96
96
  it "runs after_bugsnag_notify callbacks" do
97
97
  expect(Bugsnag::Notification).to receive(:deliver_exception_payload)
98
-
98
+
99
99
  callback_run_count = 0
100
100
  Bugsnag.after_notify_callbacks << lambda {|notif|
101
101
  callback_run_count += 1
102
102
  }
103
103
 
104
104
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
105
-
105
+
106
106
  expect(callback_run_count).to eq(1)
107
107
  end
108
108
 
@@ -111,12 +111,20 @@ describe Bugsnag::MiddlewareStack do
111
111
  Bugsnag.configure do |config|
112
112
  config.middleware.disable(Bugsnag::Middleware::Callbacks)
113
113
  end
114
-
114
+
115
115
  Bugsnag.before_notify_callbacks << lambda {|notif|
116
116
  callback_run_count += 1
117
117
  }
118
-
118
+
119
119
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
120
120
  expect(callback_run_count).to eq(0)
121
121
  end
122
+
123
+ it "does not notify if a callback told so" do
124
+ expect(Bugsnag::Notification).not_to receive(:deliver_exception_payload)
125
+ Bugsnag.before_notify_callbacks << lambda do |notif|
126
+ notif.ignore!
127
+ end
128
+ Bugsnag.notify(BugsnagTestException.new("It crashed"))
129
+ end
122
130
  end
metadata CHANGED
@@ -1,103 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-23 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - <
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
- - - '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0.6'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - <
41
+ - - "<"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '1.0'
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0.6'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '>='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rdoc
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: pry
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  description: Ruby notifier for bugsnag.com
@@ -108,10 +108,10 @@ extra_rdoc_files:
108
108
  - LICENSE.txt
109
109
  - README.md
110
110
  files:
111
- - .document
112
- - .gitignore
113
- - .rspec
114
- - .travis.yml
111
+ - ".document"
112
+ - ".gitignore"
113
+ - ".rspec"
114
+ - ".travis.yml"
115
115
  - CHANGELOG.md
116
116
  - Gemfile
117
117
  - LICENSE.txt
@@ -168,17 +168,17 @@ require_paths:
168
168
  - lib
169
169
  required_ruby_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - '>='
176
+ - - ">="
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
180
  rubyforge_project:
181
- rubygems_version: 2.0.14
181
+ rubygems_version: 2.2.2
182
182
  signing_key:
183
183
  specification_version: 4
184
184
  summary: Ruby notifier for bugsnag.com