Class: ExceptionNotification::Rails::RunnerTie

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_notification/rails/runner_tie.rb

Instance Method Summary collapse

Instance Method Details

#callObject

Registers an at_exit callback, which checks if there was an exception. This is a pretty crude way to detect exceptions from runner commands, but Rails doesn’t provide a better API.

This should only be called from a runner callback in your Rails config; otherwise you may register the at_exit callback in more places than you need or want it.



11
12
13
14
15
16
17
18
# File 'lib/exception_notification/rails/runner_tie.rb', line 11

def call
  at_exit do
    exception = $ERROR_INFO
    if exception && !exception.is_a?(SystemExit)
      ExceptionNotifier.notify_exception(exception, data: data_for_exception_notifier(exception))
    end
  end
end