Exception: Frame::APIError
Overview
API Error class for handling API responses
Direct Known Subclasses
APIConnectionError, AuthenticationError, InvalidParameterError, InvalidRequestError, RateLimitError, ResourceNotFoundError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#http_body ⇒ Object
readonly
Returns the value of attribute http_body.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#json_body ⇒ Object
readonly
Returns the value of attribute json_body.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(message = nil, http_status: nil, http_body: nil, json_body: nil, code: nil) ⇒ APIError
constructor
A new instance of APIError.
- #to_s ⇒ Object
Constructor Details
#initialize(message = nil, http_status: nil, http_body: nil, json_body: nil, code: nil) ⇒ APIError
Returns a new instance of APIError.
15 16 17 18 19 20 21 22 |
# File 'lib/frame/error.rb', line 15 def initialize( = nil, http_status: nil, http_body: nil, json_body: nil, code: nil) @message = @http_status = http_status @http_body = http_body @json_body = json_body @code = code super() end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
13 14 15 |
# File 'lib/frame/error.rb', line 13 def code @code end |
#http_body ⇒ Object (readonly)
Returns the value of attribute http_body.
11 12 13 |
# File 'lib/frame/error.rb', line 11 def http_body @http_body end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
10 11 12 |
# File 'lib/frame/error.rb', line 10 def http_status @http_status end |
#json_body ⇒ Object (readonly)
Returns the value of attribute json_body.
12 13 14 |
# File 'lib/frame/error.rb', line 12 def json_body @json_body end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/frame/error.rb', line 9 def @message end |
Instance Method Details
#to_s ⇒ Object
24 25 26 27 28 |
# File 'lib/frame/error.rb', line 24 def to_s status_string = @http_status.nil? ? "" : "(Status #{@http_status}) " code_string = @code.nil? ? "" : "(Code #{@code}) " "#{status_string}#{code_string}#{@message}" end |