def do_fail(msg)

      h.state = 'failing'
      h.applied_workitem = msg['workitem']

      if h.children.size < 1

        reply_to_parent(h.applied_workitem)

      else

        flavour = msg['immediate'] ? 'kill' : nil

        persist_or_raise

        h.children.each do |i|
          @context.storage.put_msg('cancel', 'fei' => i, 'flavour' => flavour)
        end
      end
    end
def do_fail(msg)

      h.state = 'failing'
      h.applied_workitem = msg['workitem']

      if h.children.size < 1

        reply_to_parent(h.applied_workitem)

      else

        flavour = msg['immediate'] ? 'kill' : nil

        persist_or_raise

        h.children.each do |i|
          @context.storage.put_msg('cancel', 'fei' => i, 'flavour' => flavour)
        end
      end
    end
Called when handling an on_error, will place itself in a 'failing' state
 and cancel the children (when the reply from the children comes back,
 the on_error will get triggered).