diff options
author | Alberto Vena <kennyadsl@gmail.com> | 2021-07-12 17:04:48 +0200 |
---|---|---|
committer | Alberto Vena <kennyadsl@gmail.com> | 2021-07-13 16:23:34 +0200 |
commit | 0317e228bc79c13667940203add35fa13fac21f1 (patch) | |
tree | e7e511496ad1bb7b0b0d32607cf634332192d69b /lib/solidus_subscriptions | |
parent | c9e26197b0abbe50b029c368017243314d572884 (diff) |
Pass installment to the processing error handler
This way we can provide more flexibility on things that can be
done when an error occurs.
In the provided RailsLogger handler, we'll also print the ID
of the installment.
Diffstat (limited to 'lib/solidus_subscriptions')
-rw-r--r-- | lib/solidus_subscriptions/processing_error_handlers/rails_logger.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/solidus_subscriptions/processing_error_handlers/rails_logger.rb b/lib/solidus_subscriptions/processing_error_handlers/rails_logger.rb index d209123..d6fcf7e 100644 --- a/lib/solidus_subscriptions/processing_error_handlers/rails_logger.rb +++ b/lib/solidus_subscriptions/processing_error_handlers/rails_logger.rb @@ -3,21 +3,23 @@ module SolidusSubscriptions module ProcessingErrorHandlers class RailsLogger - def self.call(exception) - new(exception).call + def self.call(exception, installment = nil) + new(exception, installment).call end - def initialize(exception) + def initialize(exception, installment = nil) @exception = exception + @installment = installment end def call - Rails.logger.error exception.message + Rails.logger.error("Error processing installment with ID=#{installment.id}:") if installment + Rails.logger.error(exception.message) end private - attr_reader :exception + attr_reader :exception, :installment end end end |