diff options
| -rw-r--r-- | Library/Homebrew/cmd/search.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 2d3a28f36..71e1d1720 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -112,7 +112,9 @@ module Homebrew extend self end end results - rescue GitHub::Error + rescue GitHub::RateLimitExceededError => e + [] + rescue GitHub::Error => e opoo "Failed to search tap: #{user}/#{repo}. Please run `brew update`" [] end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index b00413153..087831153 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -252,6 +252,7 @@ module GitHub extend self ISSUES_URI = URI.parse("https://api.github.com/legacy/issues/search/Homebrew/homebrew/open/") Error = Class.new(StandardError) + RateLimitExceededError = Class.new(Error) def open url, headers={}, &block # This is a no-op if the user is opting out of using the GitHub API. @@ -266,7 +267,7 @@ module GitHub extend self end rescue OpenURI::HTTPError => e if e.io.meta['x-ratelimit-remaining'].to_i <= 0 - raise Error, <<-EOS.undent, e.backtrace + raise RateLimitExceededError, <<-EOS.undent, e.backtrace GitHub #{Utils::JSON.load(e.io.read)['message']} You may want to create an API token: https://github.com/settings/applications and then set HOMEBREW_GITHUB_API_TOKEN. |
