Refactor error logging in manager.rb to always log transition errors if logger is present, simplifying the conditional check.

This commit is contained in:
Ari Karim 2025-05-27 14:58:23 +03:00
parent 99752aec39
commit 44018a3016
No known key found for this signature in database
GPG Key ID: 1A5559E2E32F1805

View File

@ -63,9 +63,8 @@ module Workflower
rescue Exception => e rescue Exception => e
# if the log level is set to debug, we want to log the error # if the log level is set to debug, we want to log the error
logger = Workflower.configuration.logger logger = Workflower.configuration.logger
if logger.present? && logger.level == Logger::DEBUG logger.debug("Error during transition: #{e.message}") if logger.present?
logger.debug("Error during transition: #{e.message}")
end
@calling_model.errors.add(@calling_model.workflower_state_column_name, :transition_faild) @calling_model.errors.add(@calling_model.workflower_state_column_name, :transition_faild)
false false
end end