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