class Supercast::SupercastError

SupercastError is the base error from which all other more specific Supercast errors derive.

Attributes

code[R]
http_body[R]
http_headers[R]
http_status[R]
json_body[R]
message[R]
response[RW]

Response contains a SupercastResponse 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, code: nil) click to toggle source

Initializes a SupercastError.

# File lib/supercast/errors.rb, line 20
def initialize(message = nil, http_status: nil, http_body: nil, json_body: nil, http_headers: nil, code: nil)
  @message = message
  @http_status = http_status
  @http_body = http_body
  @http_headers = http_headers || {}
  @json_body = json_body
  @code = code
end

Public Instance Methods

to_s() click to toggle source
# File lib/supercast/errors.rb, line 29
def to_s
  status_string = @http_status.nil? ? '' : "(Status #{@http_status}) "
  "#{status_string}#{@message}"
end