Module: Soundcloud::Error

Defined in:
lib/soundcloud/error.rb

Defined Under Namespace

Classes: BadRequest, ClientError, Error, Forbidden, GatewayTimeout, InternalServerError, NotAcceptable, NotFound, PaymentRequired, ServerError, ServiceUnavailable, Unauthorized, UnexpectedError, UnprocessableEntity

Constant Summary collapse

STATUS_ERROR_MAP =
Hash.new do |h, k|
      case k
      when 400...500 then :ClientError
      when 500...600 then :ServerError
      end
    end.merge(400 => :BadRequest,
401 => :Unauthorized,
402 => :PaymentRequired,
403 => :Forbidden,
404 => :NotFound,
406 => :NotAcceptable,
422 => :UnprocessableEntity,
500 => :InternalServerError,
503 => :ServiceUnavailable,
504 => :GatewayTimeout)

Class Method Summary collapse

Class Method Details

.[](status) ⇒ Object



47
48
49
# File 'lib/soundcloud/error.rb', line 47

def self.[](status)
  self.const_get(STATUS_ERROR_MAP[status])
end