Class: Appsignal::Hooks::AtExit::AtExitCallback Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/hooks/at_exit.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Report any unhandled errors and will crash the Ruby process.

If this error was previously reported by any of our instrumentation, the error will not also be reported here. This way we don’t report an error from a Rake task or instrumented script twice.

Constant Summary collapse

IGNORED_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  # Normal exits from the application we do not need to report
  SystemExit,
  SignalException
].freeze

Class Method Summary collapse

Class Method Details

.callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/appsignal/hooks/at_exit.rb', line 25

def self.call
  error = $! # rubocop:disable Style/SpecialGlobalVars
  return unless error
  return if ignored_error?(error)
  return if Appsignal::Transaction.last_errors.include?(error)

  Appsignal.report_error(error) do |transaction|
    transaction.set_namespace("unhandled")
  end
  Appsignal.stop("at_exit")
end

.ignored_error?(error) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


43
44
45
# File 'lib/appsignal/hooks/at_exit.rb', line 43

def self.ignored_error?(error)
  IGNORED_ERRORS.include?(error.class)
end