Skip to content

Commit

Permalink
participant :on_error => 'x' broken. Fixed. Thanks Oleg.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Apr 20, 2010
1 parent 6827d3b commit d0f47c3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Expand Up @@ -4,6 +4,7 @@

== ruote - 2.1.10 not yet released

- participant :on_error => 'x' broken. Fixed. Thanks Oleg.
- Engine#workitem(fei) for advanced users
- reintroduction of the 'listener' concept : lib/ruote/part/listener.rb
- LocalParticpant : added a reject(workitem) method
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.txt
Expand Up @@ -38,8 +38,8 @@ Richard Jennings
Feedback
--------

Oleg (foenixx) - many suggestions and bug reports
Avishai Shalom - discussion and ideas about participant/worker locality
Olle (foenixx) - barley issue with Sinatra 1.0
Gonzalo Suarez - many help
Francisco Kiko - many help
David Goldhirsch - EM participant block
Expand Down
8 changes: 6 additions & 2 deletions lib/ruote/exp/flowexpression.rb
Expand Up @@ -390,9 +390,13 @@ def cancel (flavour)
def do_fail (msg)

@h['state'] = 'failing'
persist_or_raise

h.children.each { |i| @context.storage.put_msg('cancel', 'fei' => i) }
if h.children.size < 1
reply_to_parent(@h['applied_workitem'])
else
persist_or_raise
h.children.each { |i| @context.storage.put_msg('cancel', 'fei' => i) }
end
end

#--
Expand Down
25 changes: 25 additions & 0 deletions test/functional/ft_5_on_error.rb
Expand Up @@ -151,5 +151,30 @@ def test_with_concurrence
assert_equal 1, a_count
assert_equal 1, e_count
end

def test_participant_on_error

pdef = Ruote.process_definition do
troublemaker :on_error => 'handle_error'
define 'handle_error' do
echo 'err...'
end
end

@engine.register_participant :troublemaker do
raise 'Beijing, we have a problem !'
end

#noisy

wfid = @engine.launch(pdef)
wait_for(wfid)

#er = @engine.process(wfid).errors.first
#puts er.message
#puts er.trace

assert_equal 'err...', @tracer.to_s
end
end

0 comments on commit d0f47c3

Please sign in to comment.