class OpenStax::RescueFrom::Logger

Attributes

exception_proxy[R]
logger[R]

Public Class Methods

new(exception_proxy, logger = Rails.logger) click to toggle source
# File lib/openstax/rescue_from/logger.rb, line 6
def initialize(exception_proxy, logger = Rails.logger)
  @exception_proxy = exception_proxy
  @logger = logger
end

Public Instance Methods

record_system_error!(prefix = "An exception occurred") click to toggle source
# File lib/openstax/rescue_from/logger.rb, line 11
def record_system_error!(prefix = "An exception occurred")
  logger.error("#{prefix}: #{exception_proxy.name} [#{exception_proxy.error_id}] " +
               "<#{exception_proxy.message}> #{exception_proxy.extras}\n\n" +
               "#{exception_proxy.logger_backtrace}")

  record_system_error_recursively!
end

Private Instance Methods

record_system_error_recursively!() click to toggle source
# File lib/openstax/rescue_from/logger.rb, line 20
def record_system_error_recursively!
  if exception_proxy.cause
    @exception_proxy = ExceptionCauseProxy.new(exception_proxy.cause)
    record_system_error!("Exception cause")
  end
end