Hi,

I've stumbled upon an issue which I'm not sure how to even address it.
If I raise a RuntimeError (simple raise) or a StandardError (specifically) 
from a participant then the flow behaves fine, i.e. I see the exception 
with #noisy and I can catch it with :on_error.
But if I raise a NameError, on some cases it just waits forever.

I'm working on a big project so at first I thought it was something related 
to the project's code, but I've managed to create a simple example that 
causes this (using latest master).

require 'ruote'
require 'ruote/storage/fs_storage'
 
ruote = Ruote::Dashboard.new(
  Ruote::Worker.new(
    Ruote::FsStorage.new('ruote_work')))

class PartA < Ruote::Participant
  def on_workitem
    raise NameError, self.class
    reply # Not really needed
  end
end

class PartB < Ruote::Participant
  def on_workitem
    raise StandardError, self.class
    reply # Not really needed
  end
end

class HandleError < Ruote::Participant
  def on_workitem
    puts workitem.param_or_field('msg')
    reply
  end
end

ruote.register 'part_a', PartA
ruote.register 'part_b', PartB
ruote.register 'handle_error', HandleError

pdef = Ruote.define do
  concurrence do
    part_a :on_error => 'handle error'
    part_b :on_error => 'handle error'
  end

  define 'handle error' do
    participant 'handle_error', :msg => 'on_error!'
  end
end

ruote.noisy = true
wfid = ruote.launch(pdef)
ruote.wait_for(wfid)

PartA and PartB are the same, except for the different Error. A few notes:

1. If you change self.class to "some string", it works. In this part, I'm 
not sure if it's some Ruby behavior I'm not familiar with, or some context 
related behavior that is caused by Ruote (or a totally different thing). I 
suspect a context issue because if you set "#{self.class}" then it works, 
so maybe self.class is being sent in a different context where it doesn't 
exist. I didn't use self.class when I saw the issue first, I called some 
different method.
2. If you change NameError to StandardError or RuntimeError, it works.
3. You can remove the :on_error attribute and it behaves the same, it was 
for me to check if maybe having an on_error handler changes the flow so 
that it works around this problem.

Does ruote handle different exceptions in a special way? Do I miss some 
fundamental Ruby behavior? (feeling kinda silly here :P)

Thanks,
Or

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"ruote" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to