Module: SimpleSpotify::Error

Defined in:
lib/simplespotify/errors.rb

Defined Under Namespace

Classes: API, AuthorizationError, BadResponse, DefaultError, NotFound, RateLimited, Unauthorized

Class Method Summary collapse

Class Method Details

.for(status_code) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/simplespotify/errors.rb', line 4

def self.for status_code
  case status_code
    when 401 then Unauthorized
    when 404 then NotFound
    when 429 then RateLimited
    when (500..599) then API
    else
      DefaultError
  end
end