diff --git a/lib/sightstone.rb b/lib/sightstone.rb index 946d06c..34aae0a 100644 --- a/lib/sightstone.rb +++ b/lib/sightstone.rb @@ -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 diff --git a/lib/sightstone/modules/sightstone_base_module.rb b/lib/sightstone/modules/sightstone_base_module.rb index 030180b..256b8fb 100644 --- a/lib/sightstone/modules/sightstone_base_module.rb +++ b/lib/sightstone/modules/sightstone_base_module.rb @@ -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 \ No newline at end of file +end diff --git a/sightstone.gemspec b/sightstone.gemspec index f51de61..8aa6838 100644 --- a/sightstone.gemspec +++ b/sightstone.gemspec @@ -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