Class: OpenWFE::ErrorJournal
- Includes:
- FeiMixin, OwfeServiceLocator
- Defined in:
- lib/openwfe/expool/errorjournal.rb
Overview
This is a base class for all error journal, don’t instantiate, work rather with InMemoryErrorJournal (only for testing envs though), or YamlErrorJournal.
Direct Known Subclasses
Instance Attribute Summary
Attributes included from ServiceMixin
Attributes included from Contextual
Class Method Summary collapse
-
.reduce_error_list(errors) ⇒ Object
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.
Instance Method Summary collapse
-
#has_errors?(wfid) ⇒ Boolean
Returns true if the given wfid (or fei) (process instance id) has had errors.
-
#initialize(service_name, application_context) ⇒ ErrorJournal
constructor
A new instance of ErrorJournal.
Methods included from OwfeServiceLocator
#get_engine, #get_error_journal, #get_expool, #get_expression_map, #get_expression_pool, #get_expression_storage, #get_expression_storages, #get_journal, #get_participant_map, #get_scheduler, #get_wfid_generator
Methods included from ServiceMixin
Methods included from Contextual
#get_work_directory, #init_service, #lookup
Methods included from Logging
#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn
Constructor Details
#initialize(service_name, application_context) ⇒ ErrorJournal
Returns a new instance of ErrorJournal.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/openwfe/expool/errorjournal.rb', line 151 def initialize (service_name, application_context) super get_expression_pool.add_observer :error do |event, *args| # # logs each error occurring in the expression pool begin record_error(ProcessError.new(*args)) rescue Exception => e lwarn { "*** process error : \n" + args.join("\n") } end end get_expression_pool.add_observer :terminate do |event, *args| # # removes error log when a process terminates fei = args[0].fei remove_error_log fei.wfid \ if fei.is_in_parent_process? end end |
Class Method Details
.reduce_error_list(errors) ⇒ Object
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.
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/openwfe/expool/errorjournal.rb', line 236 def ErrorJournal.reduce_error_list (errors) h = {} errors.each do |e| h[e.fei] = e # # last errors do override previous errors for the # same fei end h.values.sort do |error_a, error_b| error_a.date <=> error_b.date end end |
Instance Method Details
#has_errors?(wfid) ⇒ Boolean
Returns true if the given wfid (or fei) (process instance id) has had errors.
183 184 185 186 |
# File 'lib/openwfe/expool/errorjournal.rb', line 183 def has_errors? (wfid) get_error_log(wfid).size > 0 end |