diff options
| author | Jack Nagel | 2014-02-16 22:24:33 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-02-16 22:24:33 -0500 |
| commit | 6fd0125ad9e2fc4eab2639f57136d8b15cffd744 (patch) | |
| tree | 31688c2fc5d82f64070b56ecb754ab8c1ef91312 | |
| parent | 1d5ab3195cb9c19a349ccdcdf6c4f75d7c02460b (diff) | |
| download | brew-6fd0125ad9e2fc4eab2639f57136d8b15cffd744.tar.bz2 | |
Handle GitHub API authentication failures
| -rw-r--r-- | Library/Homebrew/utils.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index c6fe46a5e..1377191df 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -254,6 +254,7 @@ module GitHub extend self Error = Class.new(StandardError) RateLimitExceededError = Class.new(Error) HTTPNotFoundError = Class.new(Error) + AuthenticationFailedError = Class.new(Error) def open url, headers={}, &block # This is a no-op if the user is opting out of using the GitHub API. @@ -288,6 +289,8 @@ module GitHub extend self end case e.io.status.first + when "401", "403" + raise AuthenticationFailedError, e.message, e.backtrace when "404" raise HTTPNotFoundError, e.message, e.backtrace else |
