Exception: BlockScore::InvalidRequestError
- Defined in:
- lib/blockscore/errors/invalid_request_error.rb
Instance Attribute Summary collapse
-
#param ⇒ Object
Returns the value of attribute param.
Attributes inherited from APIError
#error_type, #http_body, #http_status
Instance Method Summary collapse
-
#initialize(response) ⇒ InvalidRequestError
constructor
Public: Creates a new instance of BlockScore::InvalidRequestError.
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ InvalidRequestError
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.} with code #{e.http_status}"
end
16 17 18 19 |
# File 'lib/blockscore/errors/invalid_request_error.rb', line 16 def initialize(response) super @param = @http_body[:error][:param] end |
Instance Attribute Details
#param ⇒ Object
Returns the value of attribute param.
3 4 5 |
# File 'lib/blockscore/errors/invalid_request_error.rb', line 3 def param @param end |
Instance Method Details
#to_s ⇒ Object
21 22 23 24 25 26 27 |
# 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 |