added exception for invalid/no api key
This commit is contained in:
@@ -42,6 +42,9 @@ end
|
||||
# Base class for exceptions raised by the gem
|
||||
class SightstoneApiException < Exception; end
|
||||
|
||||
# Raised if no or an invalid api key was passed to the api
|
||||
class InvalidApiKeyException < SightstoneApiException; end
|
||||
|
||||
# Raised if the given developer cannot be found (api returns http error code 404)
|
||||
class SummonerNotFoundException < SightstoneApiException; end
|
||||
|
||||
|
||||
@@ -28,9 +28,11 @@ class SightstoneBaseModule
|
||||
raise Sightstone::SightstoneConnectionException
|
||||
elsif response_code == 429
|
||||
raise Sightstone::RateLimitExceededException
|
||||
elsif response_code == 401
|
||||
raise Sightstone::InvalidApiKeyException
|
||||
else
|
||||
raise Sightstone::SightstoneApiException 'Unknown error occured'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'sightstone'
|
||||
s.version = '1.0.0'
|
||||
s.version = '1.1.0'
|
||||
s.date = '2014-01-01'
|
||||
s.summary = 'Ruby wrapper for riots league of legends api'
|
||||
s.description = s.summary
|
||||
|
||||
Reference in New Issue
Block a user