aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorSam McTaggart2016-03-16 21:27:55 +0000
committerXu Cheng2016-03-19 19:14:50 +0800
commit148da475710b882a17e044153102961919c48477 (patch)
treedf14cf6113306a9d127555336a9a41c56d539602 /Library
parentaf36139218ad607e1f9347876d636bed60b6e767 (diff)
downloadbrew-148da475710b882a17e044153102961919c48477.tar.bz2
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>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/search.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 8dd1ceb6a..2fd558a5c 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -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)