Exception: GetStreamRuby::ApiError

Inherits:
StreamError
  • Object
show all
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

RateLimitError

Instance Attribute Summary collapse

Instance Method Summary collapse

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(message)
  @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

#codeObject (readonly)

Returns the value of attribute code.



19
20
21
# File 'lib/getstream_ruby/errors.rb', line 19

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



19
20
21
# File 'lib/getstream_ruby/errors.rb', line 19

def details
  @details
end

#exception_fieldsObject (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_infoObject (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_bodyObject (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_codeObject (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

#unrecoverableObject (readonly)

Returns the value of attribute unrecoverable.



19
20
21
# File 'lib/getstream_ruby/errors.rb', line 19

def unrecoverable
  @unrecoverable
end