Module: Sneakers::ErrorReporter

Included in:
Worker
Defined in:
lib/sneakers/error_reporter.rb

Defined Under Namespace

Classes: DefaultLogger

Instance Method Summary collapse

Instance Method Details

#worker_error(exception, context_hash = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sneakers/error_reporter.rb', line 15

def worker_error(exception, context_hash = {})
  Sneakers.error_reporters.each do |handler|
    begin
      handler.call(exception, self, context_hash)
    rescue SignalException, SystemExit
      # ServerEngine handles these exceptions, so they are not expected
      # to be raised within the error reporter.
      # Nevertheless, they are listed here to ensure that they are not
      # caught by the rescue block below.
      raise
    rescue Exception => inner_exception
      Sneakers.logger.error '!!! ERROR REPORTER THREW AN ERROR !!!'
      Sneakers.logger.error inner_exception
      Sneakers.logger.error inner_exception.backtrace.join("\n") unless inner_exception.backtrace.nil?
    end
  end
end