honeybadger 3.4.0.beta1 → 4.0.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
  SHA256:
3
- metadata.gz: b610a8fe048c882cb15dadd39ae9adc1955e82952d58cd5852ee6ed0477a72bf
4
- data.tar.gz: d65617bd6beb55778cc44001c0d1a8703b797b180e628d5f66f1c3278986fafe
3
+ metadata.gz: cd1a07eb33ec42cce8c7c6d96bc3288e8d0279a972d4a7828116caae0f93bd8d
4
+ data.tar.gz: 36cde090bab29995bcb96a34b53e69a6f7d2eb558b5829e68715a7a05e8f62b2
5
5
  SHA512:
6
- metadata.gz: 66818e625bb5e5c8ca2c06f8ebd3e7bbac07f4caacb4955ecb90fbb77f08df014df579adf1f3606ed4d26b315c5f108764f61f459d35253a50d0473ddf3b34ec
7
- data.tar.gz: 2df50c6580e2ebed48cc1e4a9001cd94588f5cd23bfd80f451166a5ce9d6d1ecf6db4301dab7e5eddaaea67af5cf5e85e81fd6ff985800fb1738fb2dba8340b0
6
+ metadata.gz: e2545a49f6d994af837afc5add427d9049a8a5f67170b7ee701b124a010f14783484d9ad10215ac5dfa5fc4e3058a4a8774dbd74463a61bfae556466b98a94a3
7
+ data.tar.gz: 74907484ab440182d22054624c59c22cac00a07d14551efeaa2ff1df4f1fb60c08991a4fd13ef576589aaa671d7239d6762ed7aad8012c6af8c2dd1af22fcf07
@@ -4,15 +4,103 @@ CHANGELOG](http://keepachangelog.com/) for how to update this file. This project
4
4
  adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
+
8
+ ## [4.0.0] - 2018-08-21
7
9
  ### Added
8
10
  - Added `before_notify` hooks to be defined, this allows setting up of multiple
9
11
  hooks which will be invoked with a `notice` before a `notice` is sent. Each
10
12
  `before_notify` hook MUST be a `callable` (lambda, Proc etc,) with an arity of 1.
11
13
  - Added the ability to halt notices in callbacks using `notice.halt!`
14
+ - Make essential attributes on Notice writable:
15
+ ```ruby
16
+ Honeybadger.configure do |config|
17
+ config.before_notify do |notice|
18
+ notice.api_key = 'custom api key',
19
+ notice.error_message = "badgers!",
20
+ notice.error_class = 'MyError',
21
+ notice.backtrace = ["/path/to/file.rb:5 in `method'"],
22
+ notice.fingerprint = 'some unique string',
23
+ notice.tags = ['foo', 'bar'],
24
+ notice.context = { user: 33 },
25
+ notice.controller = 'MyController',
26
+ notice.action = 'index',
27
+ notice.parameters = { q: 'badgers?' },
28
+ notice.session = { uid: 42 },
29
+ notice.url = "/badgers",
30
+ end
31
+ end
32
+ ```
12
33
 
13
34
  ### Fixed
14
35
  - Ignore SIGTERM SignalExceptions.
15
36
 
37
+ ### Removed
38
+ - Removed Notice#[]
39
+
40
+ ### Changed
41
+ - The public method `Notice#backtrace` is now exposed as the raw Ruby
42
+ backtrace instead of an instance of `Honeybadger::Backtrace` (a private
43
+ class).
44
+
45
+ Before:
46
+ ```ruby
47
+ notice.backtrace # => #<Honeybadger::Backtrace>
48
+ ```
49
+
50
+ After:
51
+ ```ruby
52
+ notice.backtrace # => ["/path/to/file.rb:5 in `method'"]
53
+ ```
54
+ - `notice[:context]` now defaults to an empty Hash instead of nil.
55
+
56
+ Before:
57
+ ```ruby
58
+ notice[:context] # => nil
59
+ ```
60
+
61
+ After:
62
+ ```ruby
63
+ notice[:context] # => {}
64
+ ```
65
+ - The public method `Notice#fingerprint` now returns the original
66
+ String which was passed in from the `:fingerprint` option or the
67
+ `exception_fingerprint` callback, not a SHA1 hashed value. The value is
68
+ still hashed before sending through to the API.
69
+ - The public method `Honeybadger.exception_filter` has been deprecated in favor
70
+ of `before_notify`:
71
+ ```ruby
72
+ Honeybadger.configure do |config|
73
+ config.before_notify do |notice|
74
+ notice.halt!
75
+ end
76
+ end
77
+ ```
78
+ - The public method `Honeybadger.exception_fingerprint` has been deprecated in favor
79
+ of `before_notify`:
80
+ ```ruby
81
+ Honeybadger.configure do |config|
82
+ config.before_notify do |notice|
83
+ notice.exception_fingerprint = 'new fingerprint'
84
+ end
85
+ end
86
+ ```
87
+ - The public method `Honeybadger.backtrace_filter` has been deprecated in favor
88
+ of `before_notify`:
89
+ ```ruby
90
+ Honeybadger.configure do |config|
91
+ config.before_notify do |notice|
92
+ notice.backtrace.reject!{|x| x =~ /gem/}
93
+ end
94
+ end
95
+ ```
96
+
97
+ ### Removed
98
+ - The `disabled` option is now removed, Use the `report_data` option instead.
99
+
100
+ ## [3.3.1] - 2018-08-02
101
+ ### Fixed
102
+ - Fix synchronous throttling in shoryuken
103
+
16
104
  ## [3.3.0] - 2018-01-29
17
105
  ### Changed
18
106
  - Use prepend to add Sidekiq Middleware to fix context getting cleared.
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # Honeybadger for Ruby
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/honeybadger-io/honeybadger-ruby.png?branch=master)](http://travis-ci.org/honeybadger-io/honeybadger-ruby)
4
- [![Gem Version](https://badge.fury.io/rb/honeybadger.png)](http://badge.fury.io/rb/honeybadger)
3
+ [![Build Status](https://secure.travis-ci.org/honeybadger-io/honeybadger-ruby.svg?branch=master)](http://travis-ci.org/honeybadger-io/honeybadger-ruby)
4
+ [![Gem Version](https://badge.fury.io/rb/honeybadger.svg)](http://badge.fury.io/rb/honeybadger)
5
+ [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=honeybadger&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=honeybadger&package-manager=bundler&version-scheme=semver)
5
6
 
6
7
  This is the notifier gem for integrating apps with the :zap: [Honeybadger Exception Notifier for Ruby and Rails](http://honeybadger.io).
7
8
 
@@ -110,8 +110,6 @@ module Honeybadger
110
110
  # @return [String] UUID reference to the notice within Honeybadger.
111
111
  # @return [false] when ignored.
112
112
  def notify(exception_or_opts, opts = {})
113
- return false if config.disabled?
114
-
115
113
  if exception_or_opts.is_a?(Exception)
116
114
  opts[:exception] = exception_or_opts
117
115
  elsif exception_or_opts.respond_to?(:to_hash)
@@ -293,26 +291,26 @@ module Honeybadger
293
291
  # @yield [Config::Ruby] configuration object.
294
292
  def_delegator :config, :configure
295
293
 
296
- # Callback to ignore exceptions.
294
+ # DEPRECATED: Callback to ignore exceptions.
297
295
  #
298
296
  # See public API documentation for {Honeybadger::Notice} for available attributes.
299
297
  #
300
298
  # @example
301
299
  # # Ignoring based on error message:
302
300
  # Honeybadger.exception_filter do |notice|
303
- # notice[:error_message] =~ /sensitive data/
301
+ # notice.error_message =~ /sensitive data/
304
302
  # end
305
303
  #
306
304
  # # Ignore an entire class of exceptions:
307
305
  # Honeybadger.exception_filter do |notice|
308
- # notice[:exception].class < MyError
306
+ # notice.exception.class < MyError
309
307
  # end
310
308
  #
311
309
  # @!method exception_filter
312
310
  # @yieldreturn [Boolean] true (to ignore) or false (to send).
313
311
  def_delegator :config, :exception_filter
314
312
 
315
- # Callback to add a custom grouping strategy for exceptions. The return
313
+ # DEPRECATED: Callback to add a custom grouping strategy for exceptions. The return
316
314
  # value is hashed and sent to Honeybadger. Errors with the same fingerprint
317
315
  # will be grouped.
318
316
  #
@@ -320,14 +318,14 @@ module Honeybadger
320
318
  #
321
319
  # @example
322
320
  # Honeybadger.exception_fingerprint do |notice|
323
- # [notice[:error_class], notice[:component], notice[:backtrace].to_s].join(':')
321
+ # [notice.error_class, notice.component, notice.backtrace.to_s].join(':')
324
322
  # end
325
323
  #
326
324
  # @!method exception_fingerprint
327
325
  # @yieldreturn [#to_s] The fingerprint of the error.
328
326
  def_delegator :config, :exception_fingerprint
329
327
 
330
- # Callback to filter backtrace lines. One use for this is to make
328
+ # DEPRECATED: Callback to filter backtrace lines. One use for this is to make
331
329
  # additional [PROJECT_ROOT] or [GEM_ROOT] substitutions, which are used by
332
330
  # Honeybadger when grouping errors and displaying application traces.
333
331
  #
@@ -80,7 +80,11 @@ module Honeybadger
80
80
  end
81
81
 
82
82
  def backtrace_filter
83
- self[:backtrace_filter] = Proc.new if block_given?
83
+ if block_given?
84
+ warn('DEPRECATED: backtrace_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#backtrace_filter')
85
+ self[:backtrace_filter] = Proc.new
86
+ end
87
+
84
88
  self[:backtrace_filter]
85
89
  end
86
90
 
@@ -89,12 +93,20 @@ module Honeybadger
89
93
  end
90
94
 
91
95
  def exception_filter
92
- self[:exception_filter] = Proc.new if block_given?
96
+ if block_given?
97
+ warn('DEPRECATED: exception_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_filter')
98
+ self[:exception_filter] = Proc.new
99
+ end
100
+
93
101
  self[:exception_filter]
94
102
  end
95
103
 
96
104
  def exception_fingerprint
97
- self[:exception_fingerprint] = Proc.new if block_given?
105
+ if block_given?
106
+ warn('DEPRECATED: exception_fingerprint is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_fingerprint')
107
+ self[:exception_fingerprint] = Proc.new
108
+ end
109
+
98
110
  self[:exception_fingerprint]
99
111
  end
100
112
 
@@ -145,10 +157,6 @@ module Honeybadger
145
157
  @backend = nil
146
158
  end
147
159
 
148
- def disabled?
149
- !!self[:disabled]
150
- end
151
-
152
160
  def dev?
153
161
  self[:env] && Array(self[:development_environments]).include?(self[:env])
154
162
  end
@@ -68,11 +68,6 @@ module Honeybadger
68
68
  default: false,
69
69
  type: Boolean
70
70
  },
71
- disabled: {
72
- description: 'Prevents Honeybadger from starting entirely.',
73
- default: false,
74
- type: Boolean
75
- },
76
71
  development_environments: {
77
72
  description: 'Environments which will not report data by default (use report_data to enable/disable explicitly).',
78
73
  default: DEVELOPMENT_ENVIRONMENTS,
@@ -81,11 +81,6 @@ module Honeybadger
81
81
  get(:backend) || config.backend
82
82
  end
83
83
 
84
- def backtrace_filter
85
- hash[:backtrace_filter] = Proc.new if block_given?
86
- get(:backtrace_filter)
87
- end
88
-
89
84
  def before_notify(action = nil, &block)
90
85
  (hash[:before_notify] ||= []).tap do |before_notify_hooks|
91
86
  if action && validate_before_action(action)
@@ -96,13 +91,30 @@ module Honeybadger
96
91
  end
97
92
  end
98
93
 
94
+ def backtrace_filter
95
+ if block_given?
96
+ logger.warn('DEPRECATED: backtrace_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#backtrace_filter')
97
+ hash[:backtrace_filter] = Proc.new if block_given?
98
+ end
99
+
100
+ get(:backtrace_filter)
101
+ end
102
+
99
103
  def exception_filter
100
- hash[:exception_filter] = Proc.new if block_given?
104
+ if block_given?
105
+ logger.warn('DEPRECATED: exception_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_filter')
106
+ hash[:exception_filter] = Proc.new
107
+ end
108
+
101
109
  get(:exception_filter)
102
110
  end
103
111
 
104
112
  def exception_fingerprint
105
- hash[:exception_fingerprint] = Proc.new if block_given?
113
+ if block_given?
114
+ logger.warn('DEPRECATED: exception_fingerprint is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_fingerprint')
115
+ hash[:exception_fingerprint] = Proc.new
116
+ end
117
+
106
118
  get(:exception_fingerprint)
107
119
  end
108
120
 
@@ -66,50 +66,55 @@ module Honeybadger
66
66
  attr_reader :cause
67
67
 
68
68
  # The backtrace from the given exception or hash.
69
- attr_reader :backtrace
69
+ attr_accessor :backtrace
70
70
 
71
71
  # Custom fingerprint for error, used to group similar errors together.
72
- attr_reader :fingerprint
72
+ attr_accessor :fingerprint
73
73
 
74
74
  # Tags which will be applied to error.
75
75
  attr_reader :tags
76
+ def tags=(tags)
77
+ @tags = construct_tags(tags)
78
+ end
76
79
 
77
80
  # The name of the class of error (example: RuntimeError).
78
- attr_reader :error_class
81
+ attr_accessor :error_class
79
82
 
80
83
  # The message from the exception, or a general description of the error.
81
- attr_reader :error_message
84
+ attr_accessor :error_message
82
85
 
83
- # Deprecated: Excerpt from source file.
84
- attr_reader :source
86
+ # The context Hash.
87
+ attr_accessor :context
85
88
 
86
89
  # CGI variables such as HTTP_METHOD.
87
- def cgi_data; @request[:cgi_data]; end
90
+ attr_accessor :cgi_data
88
91
 
89
92
  # A hash of parameters from the query string or post body.
90
- def params; @request[:params]; end
93
+ attr_accessor :params
91
94
  alias_method :parameters, :params
92
95
 
93
96
  # The component (if any) which was used in this request (usually the controller).
94
- def component; @request[:component]; end
97
+ attr_accessor :component
95
98
  alias_method :controller, :component
96
99
 
97
100
  # The action (if any) that was called in this request.
98
- def action; @request[:action]; end
101
+ attr_accessor :action
99
102
 
100
103
  # A hash of session data from the request.
101
- def_delegator :@request, :session
102
- def session; @request[:session]; end
104
+ attr_accessor :session
103
105
 
104
106
  # The URL at which the error occurred (if any).
105
- def url; @request[:url]; end
107
+ attr_accessor :url
106
108
 
107
109
  # Local variables are extracted from first frame of backtrace.
108
- attr_reader :local_variables
110
+ attr_accessor :local_variables
109
111
 
110
- # Public: The API key used to deliver this notice.
112
+ # The API key used to deliver this notice.
111
113
  attr_accessor :api_key
112
114
 
115
+ # Deprecated: Excerpt from source file.
116
+ attr_reader :source
117
+
113
118
  # @api private
114
119
  # Cache project path substitutions for backtrace lines.
115
120
  PROJECT_ROOT_CACHE = {}
@@ -143,44 +148,44 @@ module Honeybadger
143
148
 
144
149
  # @api private
145
150
  def initialize(config, opts = {})
146
- @now = Time.now.utc
147
- @pid = Process.pid
148
- @id = SecureRandom.uuid
151
+ @now = Time.now.utc
152
+ @pid = Process.pid
153
+ @id = SecureRandom.uuid
154
+ @stats = Util::Stats.all
149
155
 
150
156
  @opts = opts
151
157
  @config = config
152
158
 
153
159
  @rack_env = opts.fetch(:rack_env, nil)
154
-
155
160
  @request_sanitizer = Util::Sanitizer.new(filters: params_filters)
156
161
 
157
162
  @exception = unwrap_exception(opts[:exception])
158
- @error_class = exception_attribute(:error_class, 'Notice') {|exception| exception.class.name }
159
- @error_message = exception_attribute(:error_message, 'No message provided') do |exception|
160
- "#{exception.class.name}: #{exception.message}"
161
- end
162
- @backtrace = parse_backtrace(exception_attribute(:backtrace, caller))
163
-
164
- @request = construct_request_hash(config, opts)
165
-
166
- @context = construct_context_hash(opts, exception)
167
-
168
163
  @cause = opts[:cause] || exception_cause(@exception) || $!
169
- @causes = unwrap_causes(@cause)
170
164
 
171
- @tags = construct_tags(opts[:tags])
172
- @tags = construct_tags(context[:tags]) | @tags if context
165
+ @causes = unwrap_causes(@cause)
173
166
 
174
- @stats = Util::Stats.all
167
+ self.error_class = exception_attribute(:error_class, 'Notice') {|exception| exception.class.name }
168
+ self.error_message = exception_attribute(:error_message, 'No message provided') do |exception|
169
+ "#{exception.class.name}: #{exception.message}"
170
+ end
171
+ self.backtrace = exception_attribute(:backtrace, caller)
175
172
 
176
- @local_variables = local_variables_from_exception(exception, config)
173
+ self.context = construct_context_hash(opts, exception)
174
+ self.local_variables = local_variables_from_exception(exception, config)
175
+ self.api_key = opts[:api_key] || config[:api_key]
176
+ self.tags = construct_tags(opts[:tags]) | construct_tags(context[:tags])
177
177
 
178
- @api_key = opts[:api_key] || config[:api_key]
178
+ self.url = opts[:url] || request_hash[:url] || nil
179
+ self.action = opts[:action] || request_hash[:action] || nil
180
+ self.component = opts[:controller] || opts[:component] || request_hash[:component] || nil
181
+ self.params = opts[:parameters] || opts[:params] || request_hash[:params] || {}
182
+ self.session = opts[:session] || request_hash[:session] || {}
183
+ self.cgi_data = opts[:cgi_data] || request_hash[:cgi_data] || {}
179
184
 
180
- monkey_patch_action_dispatch_test_process!
185
+ self.session = opts[:session][:data] if opts[:session] && opts[:session][:data]
181
186
 
182
187
  # Fingerprint must be calculated last since callback operates on `self`.
183
- @fingerprint = construct_fingerprint(opts)
188
+ self.fingerprint = fingerprint_from_opts(opts)
184
189
  end
185
190
 
186
191
  # @api private
@@ -188,8 +193,9 @@ module Honeybadger
188
193
  #
189
194
  # @return [Hash] JSON representation of notice.
190
195
  def as_json(*args)
191
- @request[:context] = s(context)
192
- @request[:local_variables] = local_variables if local_variables
196
+ request = construct_request_hash
197
+ request[:context] = s(context)
198
+ request[:local_variables] = local_variables if local_variables
193
199
 
194
200
  {
195
201
  api_key: s(api_key),
@@ -198,12 +204,12 @@ module Honeybadger
198
204
  token: id,
199
205
  class: s(error_class),
200
206
  message: s(error_message),
201
- backtrace: s(backtrace.to_a),
202
- fingerprint: s(fingerprint),
207
+ backtrace: s(parse_backtrace(backtrace)),
208
+ fingerprint: fingerprint_hash,
203
209
  tags: s(tags),
204
210
  causes: s(causes)
205
211
  },
206
- request: @request,
212
+ request: request,
207
213
  server: {
208
214
  project_root: s(config[:root]),
209
215
  revision: s(config[:revision]),
@@ -223,23 +229,6 @@ module Honeybadger
223
229
  ::JSON.generate(as_json(*a))
224
230
  end
225
231
 
226
- # Allows properties to be accessed using a hash-like syntax.
227
- #
228
- # @example
229
- # notice[:error_message]
230
- #
231
- # @param [Symbol] method The given key for an attribute.
232
- #
233
- # @return [Object] The attribute value.
234
- def [](method)
235
- case method
236
- when :request
237
- self
238
- else
239
- send(method)
240
- end
241
- end
242
-
243
232
  # @api private
244
233
  # Determines if this notice should be ignored.
245
234
  def ignore?
@@ -261,7 +250,7 @@ module Honeybadger
261
250
 
262
251
  private
263
252
 
264
- attr_reader :config, :opts, :context, :stats, :now, :pid, :causes,
253
+ attr_reader :config, :opts, :stats, :now, :pid, :causes,
265
254
  :request_sanitizer, :rack_env
266
255
 
267
256
  def ignore_by_origin?
@@ -333,21 +322,23 @@ module Honeybadger
333
322
  end
334
323
 
335
324
  def request_hash
336
- return {} unless rack_env
337
- Util::RequestHash.from_env(rack_env)
325
+ @request_hash ||= Util::RequestHash.from_env(rack_env)
338
326
  end
339
327
 
340
- # Construct the request object with data from various sources.
328
+ # Construct the request data.
341
329
  #
342
- # Returns Request.
343
- def construct_request_hash(config, opts)
344
- request = {}
345
- request.merge!(request_hash)
346
- request.merge!(opts)
347
- request[:component] = opts[:controller] if opts.has_key?(:controller)
348
- request[:params] = opts[:parameters] if opts.has_key?(:parameters)
330
+ # Returns Hash request data.
331
+ def construct_request_hash
332
+ request = {
333
+ url: url,
334
+ component: component,
335
+ action: action,
336
+ params: params,
337
+ session: session,
338
+ cgi_data: cgi_data,
339
+ sanitizer: request_sanitizer
340
+ }
349
341
  request.delete_if {|k,v| config.excluded_request_keys.include?(k) }
350
- request[:sanitizer] = request_sanitizer
351
342
  Util::RequestPayload.build(request)
352
343
  end
353
344
 
@@ -368,7 +359,7 @@ module Honeybadger
368
359
  context.merge!(Context(opts[:global_context]))
369
360
  context.merge!(exception_context(exception))
370
361
  context.merge!(Context(opts[:context]))
371
- context.empty? ? nil : context
362
+ context
372
363
  end
373
364
 
374
365
  def fingerprint_from_opts(opts)
@@ -382,11 +373,9 @@ module Honeybadger
382
373
  end
383
374
  end
384
375
 
385
- def construct_fingerprint(opts)
386
- fingerprint = fingerprint_from_opts(opts)
387
- if fingerprint && fingerprint.respond_to?(:to_s)
388
- Digest::SHA1.hexdigest(fingerprint.to_s)
389
- end
376
+ def fingerprint_hash
377
+ return unless fingerprint
378
+ Digest::SHA1.hexdigest(fingerprint.to_s)
390
379
  end
391
380
 
392
381
  def construct_tags(tags)
@@ -457,7 +446,7 @@ module Honeybadger
457
446
  filters: construct_backtrace_filters(opts),
458
447
  config: config,
459
448
  source_radius: config[:'exceptions.source_radius']
460
- )
449
+ ).to_a
461
450
  end
462
451
 
463
452
  # Unwrap the exception so that original exception is ignored or
@@ -499,7 +488,7 @@ module Honeybadger
499
488
  causes << {
500
489
  class: c.class.name,
501
490
  message: c.message,
502
- backtrace: parse_backtrace(c.backtrace || caller).to_a
491
+ backtrace: parse_backtrace(c.backtrace || caller)
503
492
  }
504
493
  i += 1
505
494
  c = exception_cause(c)
@@ -515,40 +504,5 @@ module Honeybadger
515
504
  def rails_params_filters
516
505
  rack_env && Array(rack_env['action_dispatch.parameter_filter']) or []
517
506
  end
518
-
519
- # This is how much Honeybadger cares about Rails developers. :)
520
- #
521
- # Some Rails projects include ActionDispatch::TestProcess globally for the
522
- # use of `fixture_file_upload` in tests. This is a bad practice because it
523
- # includes other methods -- such as #session -- which override existing
524
- # methods on *all objects*. This creates the following bug in Notice:
525
- #
526
- # When you call #session on any object which had previously defined it
527
- # (such as OpenStruct), that newly defined method calls #session on
528
- # +@request+ (defined in `ActionDispatch::TestProcess`), and if +@request+
529
- # doesn't exist in that object, it calls #session *again* on `nil`, which
530
- # also inherited it from Object, resulting in a SystemStackError.
531
- #
532
- # See https://stackoverflow.com/questions/18202261/include-actiondispatchtestprocess-prevents-guard-from-reloading-properly
533
- # for more info.
534
- #
535
- # This method restores the correct #session method on @request and warns
536
- # the user of the issue.
537
- #
538
- # Returns nothing.
539
- def monkey_patch_action_dispatch_test_process!
540
- return unless defined?(ActionDispatch::TestProcess) && defined?(self.fixture_file_upload)
541
-
542
- STDOUT.puts('WARNING: It appears you may be including ActionDispatch::TestProcess globally. Check out https://www.honeybadger.io/s/adtp for more info.')
543
-
544
- def @request.session
545
- @table[:session]
546
- end
547
-
548
- def self.session
549
- @request.session
550
- end
551
- end
552
-
553
507
  end
554
508
  end
@@ -6,16 +6,14 @@ module Honeybadger
6
6
  module Shoryuken
7
7
  class Middleware
8
8
  def call(_worker, _queue, sqs_msg, body)
9
- Honeybadger.flush do
10
- begin
11
- yield
12
- rescue => e
13
- if attempt_threshold <= receive_count(sqs_msg)
14
- Honeybadger.notify(e, parameters: notification_params(body))
15
- end
16
-
17
- raise e
9
+ begin
10
+ yield
11
+ rescue => e
12
+ if attempt_threshold <= receive_count(sqs_msg)
13
+ Honeybadger.notify(e, parameters: notification_params(body))
18
14
  end
15
+
16
+ raise e
19
17
  end
20
18
  ensure
21
19
  Honeybadger.context.clear!
@@ -26,6 +26,7 @@ module Honeybadger
26
26
 
27
27
  def self.from_env(env)
28
28
  return {} unless defined?(::Rack::Request)
29
+ return {} unless env
29
30
 
30
31
  hash, request = {}, ::Rack::Request.new(env)
31
32
 
@@ -29,7 +29,6 @@ module Honeybadger
29
29
  payload[key] = sanitizer.sanitize(opts[key])
30
30
  end
31
31
 
32
- payload[:session] = opts[:session][:data] if opts[:session] && opts[:session][:data]
33
32
  payload[:url] = sanitizer.filter_url(payload[:url]) if payload[:url]
34
33
  if payload[:cgi_data][HTTP_COOKIE_KEY]
35
34
  payload[:cgi_data][HTTP_COOKIE_KEY] = sanitizer.filter_cookies(payload[:cgi_data][HTTP_COOKIE_KEY])
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '3.4.0.beta1'.freeze
3
+ VERSION = '4.0.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0.beta1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -138,12 +138,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: 2.1.0
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - ">"
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: 1.3.1
143
+ version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
- rubygems_version: 2.7.3
146
+ rubygems_version: 2.7.6
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Error reports you can be happy about.