Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a nicer error on regexp failure #266

Merged
merged 1 commit into from
Nov 29, 2013
Merged

Conversation

fnichol
Copy link
Contributor

@fnichol fnichol commented Nov 29, 2013

Yes, I had a brain fart where I forgot how to write a regexp... but maybe catch RegexpError and just print "Invalid regex" instead of some weird stacktrack like this:

borkbork ~/devel/gh/juliandunn/chef-client (master *)$ kitchen test *centos*
-----> Starting Kitchen (v1.0.0.rc.1)
/Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/lib/kitchen/cli.rb:311:in `get_filtered_instances': target of repeat operator is not specified: /*centos*/ (RegexpError)
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/lib/kitchen/cli.rb:297:in `parse_subcommand'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/lib/kitchen/cli.rb:111:in `block in test'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/lib/kitchen/cli.rb:107:in `test'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/lib/kitchen/cli.rb:258:in `invoke_task'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/bin/kitchen:13:in `block in <top (required)>'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/lib/kitchen/errors.rb:81:in `with_friendly_errors'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/test-kitchen-1.0.0.rc.1/bin/kitchen:13:in `<top (required)>'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/bin/kitchen:19:in `load'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/bin/kitchen:19:in `<main>'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/juliandunn/.rbenv/versions/1.9.3-p448/bin/ruby_noexec_wrapper:14:in `<main>'

@fnichol
Copy link
Contributor

fnichol commented Nov 28, 2013

Noted and good UI idea. On it…

@ghost ghost assigned fnichol Nov 28, 2013
@fnichol
Copy link
Contributor

fnichol commented Nov 29, 2013

This should do the trick and contains (gasp) a test! The Kitchen CLI uses the same Regexp globbing logic for all subcommands so testing the kitchen list subcommand should be all right for the moment. Lots of feature backfilling in the near future.

fnichol added a commit that referenced this pull request Nov 29, 2013
@fnichol fnichol merged commit 7243638 into master Nov 29, 2013
@fnichol fnichol deleted the cli-better-regex-fail-message branch November 29, 2013 01:36
@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant