class Thor::Task
def run(obj, *params)
def run(obj, *params) raise NoMethodError, "the `#{meth}' task of #{obj.class} is private" if (obj.private_methods + obj.protected_methods).include?(meth) obj.send(meth, *params) rescue ArgumentError => e # backtrace sans anything in this file backtrace = e.backtrace.reject {|frame| frame =~ /^#{Regexp.escape(__FILE__)}/} # and sans anything that got us here backtrace -= caller raise e unless backtrace.empty? # okay, they really did call it wrong raise Error, "`#{meth}' was called incorrectly. Call as `#{formatted_usage}'" rescue NoMethodError => e begin raise e unless e.message =~ /^undefined method `#{meth}' for #{Regexp.escape(obj.inspect)}$/ rescue raise e end raise Error, "The #{namespace false} namespace doesn't have a `#{meth}' task" end