Module: Thor::Base::ClassMethods

Defined in:
lib/thor/levenshtein.rb

Instance Method Summary collapse

Instance Method Details

#handle_no_task_error(task, has_namespace = $thor_runner) ⇒ Object

:nodoc:

Raises:

  • (UndefinedTaskError)


9
10
11
12
13
14
15
16
17
18
# File 'lib/thor/levenshtein.rb', line 9

def handle_no_task_error(task, has_namespace = $thor_runner) #:nodoc:
  if has_namespace
    message = "Could not find task #{task.inspect} in #{namespace.inspect} namespace."
  else
    message = "Could not find task #{task.inspect}."
  end
  suggestion = find_suggestion task
  message += "\n\nDid you mean this?\n\t#{suggestion}" if suggestion
  raise UndefinedTaskError, message
end