honeybadger 4.12.0 → 5.0.0.beta1

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: dc234e187c3022616088debc469df8f765cde38e4f3f8bf008eab97ce1d0133e
4
- data.tar.gz: 45d332816e07aa7d25e78cc075c2b2017eb51a97583ed0ba4709087adab023b7
3
+ metadata.gz: d8c1f4882921eae85434c329f8d6a8fa8aaac7c0ad31bd7cef40e3e9930b5502
4
+ data.tar.gz: a7d0336a1bd9aa7bae7e5523c801a226e37faa9f55824b41b0c12b8310b7e527
5
5
  SHA512:
6
- metadata.gz: 9f344e35e9a2928a3660aa0d6a55d695d58854f81b13d0ab13be4771c6a54a38893d2d0b2cee10f44e88f19140122803aa6f423072f1c39db0124686b252884e
7
- data.tar.gz: bb7844be57da52cabf400a22fe09d5a45c9b3187e1eee224672f0ad000ea262002e16d36c754a2f5a7eedbce9b1e46bae9d765b351bf7b59c8df87a1fab46a3d
6
+ metadata.gz: ebb6062a2fa493e86b80ad4019bb4d04f52f1b241ff2eb7219a54385e49b45bf7a86f4c6f373c3c147a65d0eda9308931c813916961da7a122e2e2a9319d975f
7
+ data.tar.gz: 8f9a0f61ab7d97b6abb9660059b91689a47ebb91f770e75aa0688a10352d992e8881966034f34f6a90911d50089134a5b0a5e8dbf7ff674c93d28501aed2e367
data/CHANGELOG.md CHANGED
@@ -5,6 +5,24 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [5.0.0.beta1] - 2022-08-15
9
+ ### Changed
10
+ - Honeybadger is now initialized before Rails' initializers, allowing you to
11
+ report errors raised during startup. Config added via `Honeybadger.configure`
12
+ is added later in the Rails initialization process.
13
+
14
+ ### Added
15
+ - Support Rails 7 error reporting interface (#443)
16
+
17
+ ## [4.12.2] - 2022-08-15
18
+ ### Fixed
19
+ - Fix a bug where the auto-detected revision is blank instead of nil
20
+ - Fix inadvertent creation of invalid sessions (#441)
21
+
22
+ ## [4.12.1] - 2022-04-01
23
+ ### Fixed
24
+ - Fix Lambda plugin: support Ruby <2.5 (#428)
25
+
8
26
  ## [4.12.0] - 2022-03-30
9
27
  ### Added
10
28
  - Added `hb_wrap_handler` to automatically capture AWS Lambda handler errors
@@ -122,6 +122,7 @@ module Honeybadger
122
122
  opts = opts.dup
123
123
 
124
124
  if exception_or_opts.is_a?(Exception)
125
+ return nil if exception_or_opts.instance_variable_get(:@__hb_handled)
125
126
  opts[:exception] = exception_or_opts
126
127
  elsif exception_or_opts.respond_to?(:to_hash)
127
128
  opts.merge!(exception_or_opts.to_hash)
@@ -93,7 +93,7 @@ module Honeybadger
93
93
  end
94
94
 
95
95
  def run(cmd)
96
- Bundler.with_clean_env { `#{cmd}` }
96
+ Bundler.with_unbundled_env { `#{cmd}` }
97
97
  end
98
98
 
99
99
  def heroku_var(var, app_name, default = nil)
@@ -256,7 +256,7 @@ love: making developers awesome.
256
256
  Happy 'badgering!
257
257
 
258
258
  Sincerely,
259
- Ben, Josh and Starr
259
+ The Honeybadger Crew
260
260
  https://www.honeybadger.io/about/
261
261
 
262
262
  ⚡ --- End --------------------------------------------------------------------
@@ -300,6 +300,11 @@ module Honeybadger
300
300
  default: true,
301
301
  type: Boolean
302
302
  },
303
+ :'rails.subscriber_ignore_sources' => {
304
+ description: "Sources (strings or regexes) that should be ignored when using the Rails' (7+) native error reporter.",
305
+ default: [],
306
+ type: Array
307
+ },
303
308
  :'resque.resque_retry.send_exceptions_when_retrying' => {
304
309
  description: 'Send exceptions when retrying job.',
305
310
  default: true,
@@ -17,7 +17,7 @@ module Honeybadger
17
17
  app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserFeedback)
18
18
  end
19
19
 
20
- config.after_initialize do
20
+ config.before_initialize do
21
21
  Honeybadger.init!({
22
22
  :root => ::Rails.root.to_s,
23
23
  :env => ::Rails.env,
@@ -25,6 +25,9 @@ module Honeybadger
25
25
  :logger => Logging::FormattedLogger.new(::Rails.logger),
26
26
  :framework => :rails
27
27
  })
28
+ end
29
+
30
+ config.after_initialize do
28
31
  Honeybadger.load_plugins!
29
32
  end
30
33
  end
@@ -26,17 +26,20 @@ module Honeybadger
26
26
  mod = Module.new do
27
27
  handler_names.each do |handler|
28
28
  define_method(handler) do |event:, context:|
29
- Honeybadger.context(aws_request_id: context.aws_request_id) if context.respond_to?(:aws_request_id)
29
+ begin
30
+ Honeybadger.context(aws_request_id: context.aws_request_id) if context.respond_to?(:aws_request_id)
30
31
 
31
- super(event: event, context: context)
32
- rescue => e
33
- Honeybadger.notify(e)
34
- raise
32
+ super(event: event, context: context)
33
+ rescue => e
34
+ Honeybadger.notify(e)
35
+ raise
36
+ end
35
37
  end
36
38
  end
37
39
  end
38
40
 
39
41
  self.singleton_class.prepend(mod)
42
+ Kernel.singleton_class.prepend(mod) if self == TOPLEVEL_BINDING.eval("self")
40
43
  end
41
44
  end
42
45
 
@@ -29,6 +29,17 @@ module Honeybadger
29
29
  end
30
30
  end
31
31
 
32
+ class ErrorSubscriber
33
+ def self.report(exception, handled:, severity:, context: {}, source: nil)
34
+ return if source && ::Honeybadger.config[:'rails.subscriber_ignore_sources'].any? { |regex| regex.match?(source) }
35
+
36
+ tags = ["severity:#{severity}", "handled:#{handled}"]
37
+ tags << "source:#{source}" if source
38
+ Honeybadger.notify(exception, context: context, tags: tags)
39
+ exception.instance_variable_set(:@__hb_handled, true)
40
+ end
41
+ end
42
+
32
43
  Plugin.register :rails_exceptions_catcher do
33
44
  requirement { defined?(::Rails.application) && ::Rails.application }
34
45
 
@@ -41,6 +52,11 @@ module Honeybadger
41
52
  # Rails 3.0.x and 3.1.x
42
53
  ::ActionDispatch::ShowExceptions.prepend(ExceptionsCatcher)
43
54
  end
55
+
56
+ if defined?(::ActiveSupport::ErrorReporter)
57
+ # Rails 7
58
+ ::Rails.error.subscribe(ErrorSubscriber)
59
+ end
44
60
  end
45
61
  end
46
62
  end
@@ -4,7 +4,6 @@
4
4
  #honeybadger_feedback_form label { font-weight: bold; }
5
5
  #honeybadger_feedback_name, #honeybadger_feedback_email, #honeybadger_feedback_comment { width: 100%; padding: 0.5em; }
6
6
  #honeybadger_feedback_comment { height: 10em; }
7
- #honeybadger_feedback_submit { height: 1em; }
8
7
  #honeybadger_feedback_form .honeybadger-feedback-phone { display: none; }
9
8
  #honeybadger_feedback_link { font-size: 90%; }
10
9
  </style>
@@ -28,7 +28,7 @@ module Honeybadger
28
28
  return {} unless defined?(::Rack::Request)
29
29
  return {} unless env
30
30
 
31
- hash, request = {}, ::Rack::Request.new(env)
31
+ hash, request = {}, ::Rack::Request.new(env.dup)
32
32
 
33
33
  hash[:url] = extract_url(request)
34
34
  hash[:params] = extract_params(request)
@@ -3,9 +3,14 @@ module Honeybadger
3
3
  class Revision
4
4
  class << self
5
5
  def detect(root = Dir.pwd)
6
- from_heroku ||
6
+ revision = from_heroku ||
7
7
  from_capistrano(root) ||
8
8
  from_git
9
+
10
+ revision = revision.to_s.strip
11
+ return unless revision =~ /\S/
12
+
13
+ revision
9
14
  end
10
15
 
11
16
  private
@@ -21,12 +26,12 @@ module Honeybadger
21
26
  def from_capistrano(root)
22
27
  file = File.join(root, 'REVISION')
23
28
  return nil unless File.file?(file)
24
- File.read(file).strip rescue nil
29
+ File.read(file) rescue nil
25
30
  end
26
31
 
27
32
  def from_git
28
33
  return nil unless File.directory?('.git')
29
- `git rev-parse HEAD 2> #{File::NULL}`.strip rescue nil
34
+ `git rev-parse HEAD 2> #{File::NULL}` rescue nil
30
35
  end
31
36
  end
32
37
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '4.12.0'.freeze
3
+ VERSION = '5.0.0.beta1'.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: 4.12.0
4
+ version: 5.0.0.beta1
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: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2022-08-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -149,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  version: 2.3.0
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - ">="
152
+ - - ">"
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: 1.3.1
155
155
  requirements: []
156
156
  rubygems_version: 3.2.3
157
157
  signing_key: