Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Print friendly error on ambiguous command #2550

Closed
indirect opened this issue Jul 20, 2013 · 5 comments · Fixed by rails/thor#357 or #2581
Closed

Print friendly error on ambiguous command #2550

indirect opened this issue Jul 20, 2013 · 5 comments · Fixed by rails/thor#357 or #2581

Comments

@indirect
Copy link
Member

This should be a friendly error message using Bundler.ui.error, not a backtrace:

$ bundle i
/opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:405:in `normalize_task_name': Ambiguous task i matches [init, inject, install] (ArgumentError)
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:321:in `dispatch'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
        from /opt/boxen/rbenv/versions/2.0.0-p247/bin/bundle:23:in `load'
        from /opt/boxen/rbenv/versions/2.0.0-p247/bin/bundle:23:in `<main>'
@gnufied
Copy link
Contributor

gnufied commented Jul 20, 2013

I am wondering if this should be fixed via simple fix in thor. Thor throws generic ArgumentError rather than a thor exception when this happens. I am thinking Thor should throw a thor specific error. //cc @sferik

ssrihari pushed a commit to ssrihari/bundler that referenced this issue Jul 22, 2013
Using `UndefinedTaskError` as in `Thor#handle_no_task_error`.
@jlsuttles
Copy link
Contributor

@indirect Where/how can/should this be tested? /cc @jendiamond @joyicecloud

@indirect
Copy link
Member Author

You can just run "bundle i" (it's ambiguous between "init", "install", and … something else I don't remember.

On Jul 23, 2013, at 5:06 PM, Jessica Lynn Suttles notifications@github.com wrote:

@indirect Where/how can this be tested? /cc @jendiamond @joyicecloud


Reply to this email directly or view it on GitHub.

@xaviershay
Copy link
Contributor

Fixed!

@jendiamond
Copy link
Contributor

Awesome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.