Improve error message for invalid regex to search

Fixes https://github.com/Homebrew/homebrew/issues/50131

This commit removes the error backtrace and improves the error message
if a bad regexp is passed to `brew search`.

Closes Homebrew/homebrew#50173.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
This commit is contained in:
Sam McTaggart 2016-03-16 21:27:55 +00:00 committed by Xu Cheng
parent af36139218
commit 148da47571

View File

@ -93,6 +93,8 @@ module Homebrew
when %r{^/(.*)/$} then Regexp.new($1)
else /.*#{Regexp.escape(query)}.*/i
end
rescue RegexpError
odie "#{query} is not a valid regex"
end
def search_taps(rx)