mirror of
https://github.com/gosticks/brew.git
synced 2026-10-06 15:36:59 +00:00
Handle GitHub API authentication failures
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user