Exception: GetStreamRuby::ApiError
- Inherits:
-
StreamError
- Object
- StandardError
- StreamError
- GetStreamRuby::ApiError
- Defined in:
- lib/getstream_ruby/errors.rb
Overview
Raised on any HTTP 4xx/5xx response. Also raised when an HTTP response is received but its body is not a parseable ‘APIError` envelope, with `code = 0` and `message = “failed to parse error response”`.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#exception_fields ⇒ Object
readonly
Returns the value of attribute exception_fields.
-
#more_info ⇒ Object
readonly
Returns the value of attribute more_info.
-
#raw_response_body ⇒ Object
readonly
Returns the value of attribute raw_response_body.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#unrecoverable ⇒ Object
readonly
Returns the value of attribute unrecoverable.
Instance Method Summary collapse
-
#initialize(message:, status_code:, code:, exception_fields: nil, unrecoverable: nil, raw_response_body: nil, more_info: nil, details: nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(message:, status_code:, code:, exception_fields: nil, unrecoverable: nil, raw_response_body: nil, more_info: nil, details: nil) ⇒ ApiError
Returns a new instance of ApiError.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/getstream_ruby/errors.rb', line 22 def initialize(message:, status_code:, code:, exception_fields: nil, unrecoverable: nil, raw_response_body: nil, more_info: nil, details: nil) super() @status_code = status_code @code = code @exception_fields = exception_fields || {} @unrecoverable = unrecoverable.nil? ? false : unrecoverable @raw_response_body = raw_response_body || '' @more_info = more_info @details = details end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
19 20 21 |
# File 'lib/getstream_ruby/errors.rb', line 19 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
19 20 21 |
# File 'lib/getstream_ruby/errors.rb', line 19 def details @details end |
#exception_fields ⇒ Object (readonly)
Returns the value of attribute exception_fields.
19 20 21 |
# File 'lib/getstream_ruby/errors.rb', line 19 def exception_fields @exception_fields end |
#more_info ⇒ Object (readonly)
Returns the value of attribute more_info.
19 20 21 |
# File 'lib/getstream_ruby/errors.rb', line 19 def more_info @more_info end |
#raw_response_body ⇒ Object (readonly)
Returns the value of attribute raw_response_body.
19 20 21 |
# File 'lib/getstream_ruby/errors.rb', line 19 def raw_response_body @raw_response_body end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
19 20 21 |
# File 'lib/getstream_ruby/errors.rb', line 19 def status_code @status_code end |
#unrecoverable ⇒ Object (readonly)
Returns the value of attribute unrecoverable.
19 20 21 |
# File 'lib/getstream_ruby/errors.rb', line 19 def unrecoverable @unrecoverable end |