Exception: Grac::Exception::ClientException

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

Direct Known Subclasses

BadRequest, Conflict, Forbidden, NotFound, ServiceError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, url, body) ⇒ ClientException

Returns a new instance of ClientException.



8
9
10
11
12
# File 'lib/grac/exception.rb', line 8

def initialize(method, url, body)
  @method    = (method || "").upcase
  @url       = url
  @body      = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/grac/exception.rb', line 6

def body
  @body
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/grac/exception.rb', line 6

def method
  @method
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/grac/exception.rb', line 6

def url
  @url
end

Instance Method Details

#inspectObject



14
15
16
# File 'lib/grac/exception.rb', line 14

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

#messageObject Also known as: to_s



18
19
20
# File 'lib/grac/exception.rb', line 18

def message
  "#{@method} '#{@url}' failed with content: #{@body}"
end