On Sat, Mar 20, 2010 at 6:33 AM, [email protected] <[email protected]> wrote: > I know Ruote provides ways to handle planned errors (some one messed > something up, so the boss needs to be notified, etc.). > > But what about when an unplanned error occurs?? I've been working > really hard trying to figure this out for weeks and I can't make much > progress.
Hello Greg, sorry this is my fault : http://ruote.rubyforge.org/process_administration.html#errors right now it's still a TODO thing in the documentation m(_ _)m > What happens if an error is raised in a participant? Most of the time, > the participant exits, but there is no error message. > > What happens if you "raise" an error... as far as I can tell, the > participant exists but there is no error message printed. The only way > to see anything is to set engine.context.logger.noisy = true but that > seems round about. The process will log the error. > Also, this code seems to print no errors, even if you raise an error > in one of the participants: > > result = engine.wait_for(wfid) > engine.processes.each do |ps| > next if ps.errors.size == 0 # NOTE, even if you raise an error in a > participant, errors.size still == 0 > ps.errors.error_message.each{|e| > puts "Error: > ",e.wfid,e.error_class,e.error_message,e.when.inspect,e.error_backtrace.inspect > > } > # puts "Errors: #{ps.errors.inspect}" > # puts "#{ps.wfid}\t#{ps.wfrevision}\t#{ps.errors.size} > \t#{ps.paused}" > # BY THE WAY... the documentation suggests this code, but these fields > don't exist (which then DOES raise an error directly) > end Yes, if you look at the 'warning' at the top of that documentation page (http://ruote.rubyforge.org/process_administration.html) you'll see that this is still ruote 0.9.x code. This works with the 2.1.8 gem : ---8<--- require 'rubygems' require 'ruote' # tested with version 2.1.8 engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new())) engine.register_participant :wrongdoer do |workitem| raise "I did something wrong" end wfid = engine.launch(Ruote.process_definition { wrongdoer }) engine.wait_for(wfid) ps = engine.process(wfid) ps.errors.each do |error| puts "== error for process #{wfid}" puts puts error.message puts puts error.trace end --->8--- Gist is at http://gist.github.com/338423 Here is an extended example with "replay" : ---8<--- require 'rubygems' require 'ruote' # tested with version 2.1.8 $cop_watching = false engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new())) engine.register_participant :wrongdoer do |workitem| puts "* #{workitem.participant_name}..." raise "I do wrong" unless $cop_watching puts " I do good" end engine.register_participant :gooddoer do |workitem| puts "* #{workitem.participant_name}..." puts " I do good" end wfid = engine.launch(Ruote.process_definition do sequence do wrongdoer gooddoer end end) engine.wait_for(wfid) ps = engine.process(wfid) error = ps.errors.first puts "(ouch, something went wrong, fix and replay...)" $cop_watching = true engine.replay_at_error(ps.errors.first) engine.wait_for(wfid) puts "over." --->8--- Gist is at http://gist.github.com/338431 Sorry for the misleading documentation, my best regards, -- John Mettraux - http://jmettraux.wordpress.com -- you received this message because you are subscribed to the "ruote users" group. to post : send email to [email protected] to unsubscribe : send email to [email protected] more options : http://groups.google.com/group/openwferu-users?hl=en To unsubscribe from this group, send email to openwferu-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
