class BlockScore::InvalidRequestError

Attributes

param[RW]

Public Class Methods

new(response) click to toggle source

Public: Creates a new instance of BlockScore::InvalidRequestError.

responses - The HTTP response body from HTTParty.

Examples

begin

response = BlockScore::Person.create(...)

rescue BlockScore::InvalidRequestError => e

puts "ERROR: #{e.message} with code #{e.http_status}"

end

Calls superclass method BlockScore::APIError::new
# File lib/blockscore/errors/invalid_request_error.rb, line 16
def initialize(response)
  super
  @param = @http_body[:error][:param]
end

Public Instance Methods

to_s() click to toggle source
# File lib/blockscore/errors/invalid_request_error.rb, line 21
def to_s
  status_string = @http_status ? "(Status: #{@http_status})" : ''
  type_string = @error_type ? "(Type: #{@error_type})" : ''
  param_string = @param ? "(#{@param})" : ''

  "#{type_string} #{@message} #{param_string} #{status_string}"
end