Exception: Grac::Exception::ErrorWithInvalidContent

Inherits:
StandardError
  • Object
show all
Defined in:
lib/grac/exception.rb

Instance Method Summary collapse

Constructor Details

#initialize(method, url, status, raw_body, expected_type) ⇒ ErrorWithInvalidContent

Returns a new instance of ErrorWithInvalidContent.



81
82
83
84
85
86
87
# File 'lib/grac/exception.rb', line 81

def initialize(method, url, status, raw_body, expected_type)
  @method = (method || "").upcase
  @url = url
  @status = status
  @raw_body = raw_body
  @expected_type = expected_type
end

Instance Method Details

#inspectObject



94
95
96
# File 'lib/grac/exception.rb', line 94

def inspect
  "#{self.class.name}: #{message}"
end

#messageObject Also known as: to_s



89
90
91
92
# File 'lib/grac/exception.rb', line 89

def message
  "#{@method} '#{@url}': Got HTTP #{@status}, failed to parse as '#{@expected_type}'. " \
  "Raw Body: '#{@raw_body}'"
end