lib/ruote/exp/fe_participant.rb in ruote-2.1.4 vs lib/ruote/exp/fe_participant.rb in ruote-2.1.5

- old
+ new

@@ -160,17 +160,23 @@ 'for_engine_worker?' => participant_info.class != Array) end def cancel (flavour) - # TODO : if flavour is 'kill', why not not trigger participant.cancel ? - participant = @context.plist.lookup(h.participant_name) - participant.cancel(fei, flavour) - # TODO should this be threaded ? - # TODO should errors be intercepted here ? - reply_to_parent(h.applied_workitem) + r = if flavour == 'kill' + begin + participant.cancel(fei, 'kill') + rescue Exception => e + # intercept anything + nil + end + else + participant.cancel(fei, flavour) + end + + reply_to_parent(h.applied_workitem) if r != false end def reply_to_parent (workitem) workitem['fields'].delete('params')