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:
parent
af36139218
commit
148da47571
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user