mirror of
https://github.com/ditkrg/workflower.git
synced 2026-01-22 22:26:40 +00:00
Update error logging in manager.rb to conditionally log detailed error messages based on logger level; increment version to 0.2.7
This commit is contained in:
parent
7cb759c505
commit
99752aec39
@ -37,7 +37,6 @@ module Workflower
|
|||||||
end
|
end
|
||||||
|
|
||||||
def possible_transitions
|
def possible_transitions
|
||||||
# @transitions.where(state: @current_state).where("sequence = :seq OR sequence = :seq_plus", seq: @current_sequence, seq_plus: @current_sequence + 1).order("sequence ASC") || []
|
|
||||||
@transitions.select do |item|
|
@transitions.select do |item|
|
||||||
item[:state] == @current_state && (item[:sequence] == @current_sequence || item[:sequence] == @current_sequence + 1)
|
item[:state] == @current_state && (item[:sequence] == @current_sequence || item[:sequence] == @current_sequence + 1)
|
||||||
end
|
end
|
||||||
@ -62,8 +61,11 @@ module Workflower
|
|||||||
flow.call_after_transition(@calling_model)
|
flow.call_after_transition(@calling_model)
|
||||||
true
|
true
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "ERROR MESSAGE: #{e.message}"
|
# if the log level is set to debug, we want to log the error
|
||||||
puts "ERROR: #{e}"
|
logger = Workflower.configuration.logger
|
||||||
|
if logger.present? && logger.level == Logger::DEBUG
|
||||||
|
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
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Workflower
|
module Workflower
|
||||||
VERSION = "0.2.6"
|
VERSION = "0.2.7"
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user