Class: Respawn::ExceptionDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/respawn/exception_detector.rb

Constant Summary collapse

EXCEPTIONS =
[
  "EOFError",
  "Errno::ECONNABORTED",
  "Errno::ECONNRESET",
  "Errno::EHOSTUNREACH",
  "SocketError",
  "Faraday::ConnectionFailed",
  "Faraday::TimeoutError",
  "Faraday::ClientError",
  "Faraday::ServerError",
  "Net::OpenTimeout",
  "Net::ReadTimeout",
  "OpenSSL::SSL::SSLError",
  "OpenURI::HTTPError",
  "TestException",
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(env: Environment.default) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/respawn/exception_detector.rb', line 22

def self.call(env: Environment.default)
  if env.test?
    new.call
  else
    @_call ||= new.call
  end
end

Instance Method Details

#callObject



30
31
32
33
34
# File 'lib/respawn/exception_detector.rb', line 30

def call
  EXCEPTIONS.filter_map do
    Object.const_get(it) if Object.const_defined?(it)
  end
end