class Scale::HttpError

Attributes

message[R]
original_exception[R]
response[R]
status_code[R]

Public Class Methods

new(exception) click to toggle source
# File lib/scale/http_error.rb, line 5
def initialize(exception)
  @original_exception = exception
  @response = Scale.hash(JSON.parse(exception.response.body)) rescue Scale.hash()
  @status_code = response[:status_code] || e.original_exception.response.code rescue 500
  @message = response[:message] || response[:error]
end

Public Instance Methods

code() click to toggle source
# File lib/scale/http_error.rb, line 12
def code
  status_code
end