class GrowthPush::Exception

Attributes

code[RW]
status[RW]

Public Class Methods

handle_response(response) click to toggle source
# File lib/growth_push/exception.rb, line 6
def handle_response(response)
  klass = klass_for_status(response.code.to_i)
  exception = if klass
                klass.new(response.code, response.message)
              else
                Exception.new(response.code.to_i, response.code, response.message)
              end
end
klass_for_status(status) click to toggle source
# File lib/growth_push/exception.rb, line 15
def klass_for_status(status)
  case status
  when 400
    BadRequest
  when 401
    Unauthorized
  when 404
    NotFound
  when 500
    InternalServerError
  end
end
new(status, code, message) click to toggle source
Calls superclass method
# File lib/growth_push/exception.rb, line 29
def initialize(status, code, message)
  @status = status
  @code   = code
  super message
end