Class: SolidusSixSaferpay::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_six_saferpay/error_handler.rb

Class Method Summary collapse

Class Method Details

.handle(error, level: :error) ⇒ Object

Use a custom error handler so that host applications can configure their error handling



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/solidus_six_saferpay/error_handler.rb', line 6

def self.handle(error, level: :error)
  Rails.logger.send(level, error)

  Configuration.error_handlers.each do |handler|
    if !handler.respond_to?(:call)
      Rails.logger.warn("SolidusSixSaferpay::Configuration ERROR: The attached error handler #{handler} can not be called with #{handler}.call(error, level: level)")

      # skip to next handler
      next
    end
    handler.call(error, level: level)
  end
end