class TheCaptain::Error::StandardException

Attributes

http_body[R]
http_headers[R]
http_status[R]
message[R]

Public Class Methods

new(message = "", http_response = nil) click to toggle source
# File lib/the_captain/error/standard_exception.rb, line 8
def initialize(message = "", http_response = nil)
  @message = message

  if http_response
    @http_headers = http_response.headers
    @http_status  = "#{http_response.status.code} => #{http_response.status.reason}"
    @http_body    = http_response.to_s
  end
end

Public Instance Methods

to_s() click to toggle source
# File lib/the_captain/error/standard_exception.rb, line 18
def to_s
  out_message = message
  out_message += "\n(Status: #{http_status})"            unless http_status.nil?
  out_message += "\nRaw request body: #{http_body}"      unless http_body.nil?
  out_message += "\nResponse Headers: #{http_headers}\n" unless http_headers.nil?
  out_message
end