# File lib/ruote/exp/fe_on_error.rb, line 66
    def apply

      regex = nil
      handler = attribute_text

      if handler == ''
        regex = (attributes.keys - COMMON_ATT_KEYS).first
        handler = attribute(regex)
      end

      if tree.last.size > 0
        regex = handler
        handler = [ 'sequence', {}, Ruote.fulldup(tree.last) ]
      end

      return reply_to_parent(h.applied_workitem) if regex.nil? && handler.nil?
        # nothing to register, let's move on

      par = parent
      oe = par.h.on_error

      if oe.is_a?(String) or Ruote.is_tree?(oe)
        oe = [ nil, oe ]
      end

      oe = Array(par.h.on_error).compact
      oe << [ regex, handler, fei.child_id ]

      par.h.on_error = oe

      if par.do_persist
        reply_to_parent(h.applied_workitem) # success
      else
        apply # try again
      end
    end