Class: Xcflushd::FlusherErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/xcflushd/flusher_error_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(logger, storage) ⇒ FlusherErrorHandler

Returns a new instance of FlusherErrorHandler.



27
28
29
30
# File 'lib/xcflushd/flusher_error_handler.rb', line 27

def initialize(logger, storage)
  @logger = logger
  @storage = storage
end

Instance Method Details

#handle_auth_errors(failed_auths) ⇒ Object

Parameters:

  • failed_auths (Hash<Auth, Exception>)


39
40
41
# File 'lib/xcflushd/flusher_error_handler.rb', line 39

def handle_auth_errors(failed_auths)
  failed_auths.values.each { |exception| log(exception) }
end

#handle_renew_auth_error(exception) ⇒ Object

Parameters:

  • exception (Exception)


44
45
46
47
48
49
50
# File 'lib/xcflushd/flusher_error_handler.rb', line 44

def handle_renew_auth_error(exception)
  # Failing to renew an authorization in the cache should not be a big
  # problem. It is probably caused by a temporary issue (like a Redis
  # connection error) and the auth will probably be successfully renewed
  # next time. So for now, we just log the error.
  log(exception)
end

#handle_report_errors(failed_reports) ⇒ Object

Parameters:

  • failed_reports (Hash<Report, Exception>)


33
34
35
36
# File 'lib/xcflushd/flusher_error_handler.rb', line 33

def handle_report_errors(failed_reports)
  failed_reports.values.each { |exception| log(exception) }
  storage.report(failed_reports.keys)
end