class Blanket::Exception

The base class for all Blanket Exceptions

Attributes

message[W]

Attribute writer for the Exception message

response[R]

Attribute reader for the Exception http response

Public Class Methods

new(response = nil) click to toggle source

Creates a new exception @param [HTTParty::Response] response the HTTP Response @return [Blanket::Exception] The Blanket Exception object

# File lib/blanket/exception.rb, line 59
def initialize(response = nil)
  @response = response
end

Public Instance Methods

body() click to toggle source

Returns the HTTP response body

# File lib/blanket/exception.rb, line 64
def body
  @response.body.to_s if @response
end
code() click to toggle source

Returns the HTTP status code

# File lib/blanket/exception.rb, line 69
def code
  @response.code.to_i if @response
end
inspect() click to toggle source

Returns a stringified error message

# File lib/blanket/exception.rb, line 79
def inspect
  "#{message}: #{body}"
end
Also aliased as: to_s
message() click to toggle source

Returns a formatted error message

# File lib/blanket/exception.rb, line 74
def message
  @message || self.class.name
end
to_s()
Alias for: inspect