Skip to content

Commit

Permalink
Merge pull request #32 from airbrake/28-special-case-system-exit
Browse files Browse the repository at this point in the history
airbrake-ruby: reraise SystemExit instead of raising Airbrak::Error
  • Loading branch information
kyrylo committed Jan 18, 2016
2 parents 53134c8 + a801ba5 commit c4ef8c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Airbrake Ruby Changelog
([#21](https://github.com/airbrake/airbrake-ruby/pull/21))
* Made the asynchronous delivery mechanism more robust
([#26](https://github.com/airbrake/airbrake-ruby/pull/26))
* Improved `SystemExit` handling by ignoring it on a different level, which
fixed issues with the Rake integration for the [airbrake gem][airbrake-gem]
gem ([#32](https://github.com/airbrake/airbrake-ruby/pull/32))

### [v1.0.2][v1.0.2] (January 3, 2016)

Expand Down
8 changes: 5 additions & 3 deletions lib/airbrake-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ def call_notifier(notifier, method, *args, &block)
if @notifiers.key?(notifier)
@notifiers[notifier].__send__(method, *args, &block)
else
# If we raise SystemExit, the Ruby process can gracefully quit without
# the unwanted Airbrake::Error.
raise args.first if args.first.class == SystemExit

raise Airbrake::Error,
"the '#{notifier}' notifier isn't configured"
end
Expand All @@ -289,7 +293,5 @@ def call_notifier(notifier, method, *args, &block)

# Notify of unhandled exceptions, if there were any, but ignore SystemExit.
at_exit do
if $ERROR_INFO && $ERROR_INFO.class != SystemExit
Airbrake.notify_sync($ERROR_INFO)
end
Airbrake.notify_sync($ERROR_INFO) if $ERROR_INFO
end

0 comments on commit c4ef8c3

Please sign in to comment.