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.



75
76
77
78
79
80
81
# File 'lib/grac/exception.rb', line 75

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



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

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

#messageObject Also known as: to_s



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

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