aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorJack Nagel2013-07-01 16:58:16 -0500
committerJack Nagel2013-07-01 17:00:08 -0500
commit59fdcfd4d0b5d68423cbcc5033ac3884b39db909 (patch)
treea813cbc9a5dae34c16043b9e9e3fe4e19a899216 /Library/Homebrew/utils.rb
parent621c44dbd2e9e1887e2f3feff7868e9501c6ba0a (diff)
downloadbrew-59fdcfd4d0b5d68423cbcc5033ac3884b39db909.tar.bz2
Better behavior for failed connections in `brew search`
Fixes Homebrew/homebrew#20868.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 57760c3ec..346365d77 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -261,6 +261,8 @@ end
module GitHub extend self
ISSUES_URI = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/")
+ Error = Class.new(StandardError)
+
def open url, headers={}, &block
default_headers = {'User-Agent' => HOMEBREW_USER_AGENT}
default_headers['Authorization'] = "token #{HOMEBREW_GITHUB_API_TOKEN}" if HOMEBREW_GITHUB_API_TOKEN
@@ -271,6 +273,8 @@ module GitHub extend self
else
raise e
end
+ rescue SocketError => e
+ raise Error, "Failed to connect to: #{url}\n#{e.message}"
end
def each_issue_matching(query, &block)