Group all BANNED errors in Honeybadger (#5027) [deploy]

This commit is contained in:
Molly Struve 2019-12-06 10:59:27 -06:00 committed by GitHub
parent 390192afba
commit addec4b72d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -8,8 +8,10 @@ Honeybadger.configure do |config|
config.request.filter_keys += %w[authorization]
config.before_notify do |notice|
if notice.error_message&.include?("SIGTERM") && notice.component&.include?("fetch_all_rss")
notice.fingerprint = notice.error_message
end
notice.fingerprint = if notice.error_message&.include?("SIGTERM") && notice.component&.include?("fetch_all_rss")
notice.error_message
elsif notice.error_message&.include?("BANNED")
"banned"
end
end
end

View file

@ -10,4 +10,14 @@ describe Honeybadger do
expect(notice.fingerprint).to eq(notice.error_message)
end
end
context "when BANNED error is raised" do
it "sets fingerprint to banned" do
notice = Honeybadger::Notice.new(
described_class.config, error_message: "RuntimeError: BANNED"
)
described_class.config.before_notify_hooks.first.call(notice)
expect(notice.fingerprint).to eq("banned")
end
end
end