honeybadger 4.12.2 → 5.0.0

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
  SHA256:
3
- metadata.gz: 27ff7c374bbf6bcfb0086d8494399ecaf46b20cca0f37cb032abc883e3115c85
4
- data.tar.gz: 658f3b9ef36a76771265af32bddbf3c6e720385c8051cece4b15f339abdad364
3
+ metadata.gz: b2a2ce33f6ebc41718667b59e4c9aafa07ff171b7ebaa01ec6f0dda61ee5f35b
4
+ data.tar.gz: 3c84dc54194ffaaf5c5623048de44d6a9c22e64684c877b16c725836a63f5017
5
5
  SHA512:
6
- metadata.gz: 0641dd6546f0ac77ed8175331791708f0de21a540ab6e0d7aacb56e39ed60c5e65252f6f8d7c3959df859f2dedf210df2055d38337e546e92d74ff46f0aadefa
7
- data.tar.gz: a1ee0bd23a820ef6bcb90e05901d984418347987e2d23202ea02e43799e2f4c6ef9a7f5f84bba8a888ff7747baef76280b7a79e8993ceadafaa05d0bd465e4ac
6
+ metadata.gz: 4733b0ed3b93686aa2441d0e24e07535de45130da9145bf53efae6b0e3a6ccb86b322f72fcaea1cc307a6714f3a1d9c3ac106492b6d95ddabda861df940cbae6
7
+ data.tar.gz: b7aed73d5785b846faa2186a8d6f6549a43c8fdc33a42f3b52db93c4e3ba7cc6b2c4768e31ad5904fd94add2659d73361bf17de1278c025c67a82ffc1143f0b1
data/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [5.0.0] - 2022-10-18
9
+ ### Changed
10
+ - `Honeybadger.notify` is now idempotent; it will skip reporting exception
11
+ objects that have already been reported before, and simply return the existing
12
+ notice ID.
13
+ - Honeybadger is now initialized before Rails' initializers, allowing you to
14
+ report errors raised during startup. Config added via `Honeybadger.configure`
15
+ is added later in the Rails initialization process.
16
+
17
+ ### Added
18
+ - Support Rails 7 error reporting interface (#443)
19
+
20
+ ### Fixed
21
+ - Replace deployhook with release webhook (#444)
22
+ See https://blog.heroku.com/deployhooks-sunset
23
+
8
24
  ## [4.12.2] - 2022-08-15
9
25
  ### Fixed
10
26
  - Fix a bug where the auto-detected revision is blank instead of nil
@@ -122,6 +122,9 @@ module Honeybadger
122
122
  opts = opts.dup
123
123
 
124
124
  if exception_or_opts.is_a?(Exception)
125
+ already_reported_notice_id = exception_or_opts.instance_variable_get(:@__hb_notice_id)
126
+ return already_reported_notice_id if already_reported_notice_id
127
+
125
128
  opts[:exception] = exception_or_opts
126
129
  elsif exception_or_opts.respond_to?(:to_hash)
127
130
  opts.merge!(exception_or_opts.to_hash)
@@ -171,6 +174,10 @@ module Honeybadger
171
174
  push(notice)
172
175
  end
173
176
 
177
+ if exception_or_opts.is_a?(Exception)
178
+ exception_or_opts.instance_variable_set(:@__hb_notice_id, notice.id) unless exception_or_opts.frozen?
179
+ end
180
+
174
181
  notice.id
175
182
  end
176
183
 
@@ -23,7 +23,7 @@ module Honeybadger
23
23
  exit(1)
24
24
  end
25
25
 
26
- cmd = %Q(heroku addons:create deployhooks:http --url="https://api.honeybadger.io/v1/deploys?deploy[environment]=#{rails_env}&deploy[local_username]={{user}}&deploy[revision]={{head}}&api_key=#{api_key}"#{app ? " --app #{app}" : ''})
26
+ cmd = %Q(heroku webhooks:add -i api:release -l notify -u "https://api.honeybadger.io/v1/deploys/heroku?environment=#{rails_env}&api_key=#{api_key}"#{app ? " --app #{app}" : ''})
27
27
 
28
28
  say("Running: `#{cmd}`")
29
29
  say(run(cmd))
@@ -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
@@ -29,6 +29,16 @@ 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
+ end
40
+ end
41
+
32
42
  Plugin.register :rails_exceptions_catcher do
33
43
  requirement { defined?(::Rails.application) && ::Rails.application }
34
44
 
@@ -41,6 +51,11 @@ module Honeybadger
41
51
  # Rails 3.0.x and 3.1.x
42
52
  ::ActionDispatch::ShowExceptions.prepend(ExceptionsCatcher)
43
53
  end
54
+
55
+ if defined?(::ActiveSupport::ErrorReporter)
56
+ # Rails 7
57
+ ::Rails.error.subscribe(ErrorSubscriber)
58
+ end
44
59
  end
45
60
  end
46
61
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '4.12.2'.freeze
3
+ VERSION = '5.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: 4.12.2
4
+ version: 5.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: 2022-08-15 00:00:00.000000000 Z
11
+ date: 2022-10-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email: