Exception: FlatApi::FlatError
- Inherits:
-
StandardError
- Object
- StandardError
- FlatApi::FlatError
- Defined in:
- lib/flat_api/errors.rb
Direct Known Subclasses
FlatAuthenticationError, FlatAuthorizationError, FlatNotFoundError, FlatQuotaError, FlatRateLimitError, FlatServerError, FlatValidationError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status: nil, code: nil, request_id: nil, headers: nil, body: nil) ⇒ FlatError
constructor
A new instance of FlatError.
- #to_s ⇒ Object
Constructor Details
#initialize(message, status: nil, code: nil, request_id: nil, headers: nil, body: nil) ⇒ FlatError
Returns a new instance of FlatError.
14 15 16 17 18 19 20 21 22 |
# File 'lib/flat_api/errors.rb', line 14 def initialize(, status: nil, code: nil, request_id: nil, headers: nil, body: nil) super() @status = status @code = code # Present only for internal and backend errors, so treat it as optional. @request_id = request_id @headers = headers || {} @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
12 13 14 |
# File 'lib/flat_api/errors.rb', line 12 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
12 13 14 |
# File 'lib/flat_api/errors.rb', line 12 def code @code end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
12 13 14 |
# File 'lib/flat_api/errors.rb', line 12 def headers @headers end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
12 13 14 |
# File 'lib/flat_api/errors.rb', line 12 def request_id @request_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/flat_api/errors.rb', line 12 def status @status end |
Instance Method Details
#to_s ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/flat_api/errors.rb', line 24 def to_s parts = [super] parts << "code=#{code}" if code parts << "status=#{status}" if status parts << "id=#{request_id}" if request_id parts.join(' ') end |