Skip to content

Commit

Permalink
Merge pull request #525 from airbrake/1045-poor-error-msg
Browse files Browse the repository at this point in the history
notice_notifier: fix confusing error message
  • Loading branch information
kyrylo authored Dec 16, 2019
2 parents 0e168f4 + 6651782 commit fd89b78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Airbrake Ruby Changelog

### master

* `NoticeNotifier` fixed confusing error message when trying to build a notice
when Airbrake was closed
([#525](https://github.com/airbrake/airbrake-ruby/pull/525))

### [v4.10.1][v4.10.1] (December 12, 2019)

* Fixed bug in `PerformanceNotifier` where resource's `start_time` and
Expand Down
3 changes: 2 additions & 1 deletion lib/airbrake-ruby/notice_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def delete_filter(filter_class)
def build_notice(exception, params = {})
if @async_sender.closed?
raise Airbrake::Error,
"attempted to build #{exception} with closed Airbrake instance"
"Airbrake is closed; can't build exception: " \
"#{exception.class}: #{exception}"
end

if exception.is_a?(Airbrake::Notice)
Expand Down
4 changes: 2 additions & 2 deletions spec/notice_notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@
end

it "raises error" do
expect { subject.build_notice(Exception.new) }.to raise_error(
expect { subject.build_notice(Exception.new('oops')) }.to raise_error(
Airbrake::Error,
'attempted to build Exception with closed Airbrake instance',
"Airbrake is closed; can't build exception: Exception: oops",
)
end
end
Expand Down

0 comments on commit fd89b78

Please sign in to comment.