Class | OpenWFE::ErrorJournal |
In: |
lib/openwfe/expool/errorjournal.rb
|
Parent: | Service |
This is a base class for all error journal, don‘t instantiate, work rather with InMemoryErrorJournal (only for testing envs though), or YamlErrorJournal.
# File lib/openwfe/expool/errorjournal.rb, line 151 151: def initialize (service_name, application_context) 152: 153: super 154: 155: get_expression_pool.add_observer :error do |event, *args| 156: # 157: # logs each error occurring in the expression pool 158: 159: begin 160: 161: record_error(ProcessError.new(*args)) 162: 163: rescue Exception => e 164: lwarn { "*** process error : \n" + args.join("\n") } 165: end 166: end 167: 168: get_expression_pool.add_observer :terminate do |event, *args| 169: # 170: # removes error log when a process terminates 171: 172: fei = args[0].fei 173: 174: remove_error_log fei.wfid \ 175: if fei.is_in_parent_process? 176: end 177: end
A utility method : given a list of errors, will make sure that for each flow expression only one expression (the most recent) will get listed. Returns a list of errors, from the oldest to the most recent.
Could be useful when considering a process where multiple replay attempts failed.
# File lib/openwfe/expool/errorjournal.rb, line 236 236: def ErrorJournal.reduce_error_list (errors) 237: 238: h = {} 239: 240: errors.each do |e| 241: h[e.fei] = e 242: # 243: # last errors do override previous errors for the 244: # same fei 245: end 246: 247: h.values.sort do |error_a, error_b| 248: error_a.date <=> error_b.date 249: end 250: end