class Helio::HelioError

HelioError is the base error from which all other more specific Helio errors derive.

Attributes

http_body[R]

These fields are now available as part of response and that usage should be preferred.

http_headers[R]
http_status[R]
json_body[R]
message[R]
request_id[R]
response[RW]

Response contains a HelioResponse object that has some basic information about the response that conveyed the error.

Public Class Methods

new(message = nil, http_status: nil, http_body: nil, json_body: nil, http_headers: nil) click to toggle source

Initializes a HelioError.

# File lib/helio/errors.rb, line 22
def initialize(message = nil, http_status: nil, http_body: nil, json_body: nil,
               http_headers: nil)
  @message = message
  @http_status = http_status
  @http_body = http_body
  @http_headers = http_headers || {}
  @json_body = json_body
  @request_id = @http_headers[:request_id]
end

Public Instance Methods

to_s() click to toggle source
# File lib/helio/errors.rb, line 32
def to_s
  status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
  id_string = @request_id.nil? ? "" : "(Request #{@request_id}) "
  "#{status_string}#{id_string}#{@message}"
end