# frozen_string_literal: true
module ContextRequestSubscriber
module ErrorHandler
# :nodoc:
class LogErrorHandler - ContextRequestSubscriber::ErrorHandler::LogErrorHandler has no descriptive comment
def initialize(logger = nil)
@logger = (logger || ContextRequestSubscriber.logger) - ContextRequestSubscriber::ErrorHandler::LogErrorHandler#initialize is controlled by argument 'logger'
end
def call(error, _info, _properties, _payload) - ContextRequestSubscriber::ErrorHandler::LogErrorHandler#call has 4 parameters
@logger.error("Error recieved during processing the message. \
Error #{error}.")
@logger.error(error.backtrace.join("\n")) if error.backtrace - ContextRequestSubscriber::ErrorHandler::LogErrorHandler#call calls 'error.backtrace' 2 times
end
end
# :nodoc:
class LogAndRaiseErrorHandler < LogErrorHandler - ContextRequestSubscriber::ErrorHandler::LogAndRaiseErrorHandler has no descriptive comment
def call(error, info, properties, payload) - ContextRequestSubscriber::ErrorHandler::LogAndRaiseErrorHandler#call has 4 parameters
super(error, info, properties, payload)
raise error
end
end
end
end