From 148da475710b882a17e044153102961919c48477 Mon Sep 17 00:00:00 2001 From: Sam McTaggart Date: Wed, 16 Mar 2016 21:27:55 +0000 Subject: 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 --- Library/Homebrew/cmd/search.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Library/Homebrew') 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) -- cgit v1.2.3