Method: Roby::Application#action_from_name

Defined in:
lib/roby/app.rb

#action_from_name(name) ⇒ Actions::Models::Action

Finds the action matching the given name

Unlike #find_action_from_name, it raises if no matching action has been found

Returns:

Raises:

  • (ActionResolutionError)

    if either none or more than one action interface provide an action with this name



3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
# File 'lib/roby/app.rb', line 3144

def action_from_name(name)
    action = find_action_from_name(name)
    unless action
        available_actions = planners.map do |planner_model|
            planner_model.each_action.map(&:name)
        end.flatten
        if available_actions.empty?
            raise ActionResolutionError,
                  "cannot find an action named #{name}, "\
                  "there are no actions defined"
        else
            raise ActionResolutionError,
                  "cannot find an action named #{name}, "\
                  "available actions are: #{available_actions.sort.join(', ')}"
        end
    end
    action
end