diff --git a/CHANGELOG.md b/CHANGELOG.md index ac723153..0df93546 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/airbrake-ruby.rb b/lib/airbrake-ruby.rb index abac9996..5081ff7d 100644 --- a/lib/airbrake-ruby.rb +++ b/lib/airbrake-ruby.rb @@ -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 @@ -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