honeybadger 4.12.2 → 5.0.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
  SHA256:
3
- metadata.gz: 27ff7c374bbf6bcfb0086d8494399ecaf46b20cca0f37cb032abc883e3115c85
4
- data.tar.gz: 658f3b9ef36a76771265af32bddbf3c6e720385c8051cece4b15f339abdad364
3
+ metadata.gz: ce4d8e948a9b1aa7d8edf4b1e77767fc7909f5877b46788de9ef925c58face3b
4
+ data.tar.gz: 42a7d821dd8ce1d0f6d670e1f7391cd1fd5bfa310b57b2945516c008ade0e1cf
5
5
  SHA512:
6
- metadata.gz: 0641dd6546f0ac77ed8175331791708f0de21a540ab6e0d7aacb56e39ed60c5e65252f6f8d7c3959df859f2dedf210df2055d38337e546e92d74ff46f0aadefa
7
- data.tar.gz: a1ee0bd23a820ef6bcb90e05901d984418347987e2d23202ea02e43799e2f4c6ef9a7f5f84bba8a888ff7747baef76280b7a79e8993ceadafaa05d0bd465e4ac
6
+ metadata.gz: 55b094597032dab7dc362ae2f31ed35229ccfc1624abb314ceb9d1b52a0dd3ad6d2dda93965427559695de8161d95728fdba0c63878401493db2110d752e9d84
7
+ data.tar.gz: 92e37f0cf6da8732499bb0a4fc98d3f9e8b637a5c3d60d9ae5769e8028c59859367ca5f365dbc53de9bf6c3cc656ed0792090eaa7a0fea521dca4f54b1d469aa
data/CHANGELOG.md CHANGED
@@ -5,6 +5,30 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [5.0.1] - 2022-10-27
9
+ ### Fixed
10
+ - Ignore `Sidekiq::JobRetry` skip exception. Since support was added for Rails 7
11
+ error reporting interface these exceptions are being reported in addition to
12
+ the exception that caused the job to be retried. Mike Perham says these
13
+ exceptions can safely be ignored.
14
+ See https://github.com/rails/rails/pull/43625#issuecomment-1071574110
15
+
16
+ ## [5.0.0] - 2022-10-18
17
+ ### Changed
18
+ - `Honeybadger.notify` is now idempotent; it will skip reporting exception
19
+ objects that have already been reported before, and simply return the existing
20
+ notice ID.
21
+ - Honeybadger is now initialized before Rails' initializers, allowing you to
22
+ report errors raised during startup. Config added via `Honeybadger.configure`
23
+ is added later in the Rails initialization process.
24
+
25
+ ### Added
26
+ - Support Rails 7 error reporting interface (#443)
27
+
28
+ ### Fixed
29
+ - Replace deployhook with release webhook (#444)
30
+ See https://blog.heroku.com/deployhooks-sunset
31
+
8
32
  ## [4.12.2] - 2022-08-15
9
33
  ### Fixed
10
34
  - 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))
@@ -28,7 +28,8 @@ module Honeybadger
28
28
  'Rack::QueryParser::InvalidParameterError',
29
29
  'CGI::Session::CookieStore::TamperedWithCookie',
30
30
  'Mongoid::Errors::DocumentNotFound',
31
- 'Sinatra::NotFound'].map(&:freeze).freeze
31
+ 'Sinatra::NotFound',
32
+ 'Sidekiq::JobRetry::Skip'].map(&:freeze).freeze
32
33
 
33
34
  DEVELOPMENT_ENVIRONMENTS = ['development', 'test', 'cucumber'].map(&:freeze).freeze
34
35
 
@@ -300,6 +301,11 @@ module Honeybadger
300
301
  default: true,
301
302
  type: Boolean
302
303
  },
304
+ :'rails.subscriber_ignore_sources' => {
305
+ description: "Sources (strings or regexes) that should be ignored when using the Rails' (7+) native error reporter.",
306
+ default: [],
307
+ type: Array
308
+ },
303
309
  :'resque.resque_retry.send_exceptions_when_retrying' => {
304
310
  description: 'Send exceptions when retrying job.',
305
311
  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.1'.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.1
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-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email: