Exception: BehaviorTree::NodeTypeDoesNotExistError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/behavior_tree/errors.rb

Overview

Exception for incorrect node type when using the DSL builder.

Instance Method Summary collapse

Constructor Details

#initialize(missing_method, suggestion, method_alias) ⇒ NodeTypeDoesNotExistError

Returns a new instance of NodeTypeDoesNotExistError.



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/behavior_tree/errors.rb', line 38

def initialize(missing_method, suggestion, method_alias)
  suggestion = suggestion.to_s
  method_alias = method_alias.to_s

  err = ["Node type '#{missing_method}' does not exist."]
  unless suggestion.empty?
    alias_text = method_alias.empty? ? '' : " (alias of #{method_alias})"
    err << "Did you mean '#{suggestion}'#{alias_text}?"
  end

  super err.join ' '
end