class ExceptionNotification::Rails::RunnerTie
Public Instance Methods
Source
# 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
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.
Private Instance Methods
Source
# File lib/exception_notification/rails/runner_tie.rb, line 22 def data_for_exception_notifier(exception = nil) data = {} data[:error_class] = exception.class.name if exception data[:error_message] = exception.message if exception data end