Exception: NetHTTPUtils::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/nethttputils.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, code = nil) ⇒ Error

Returns a new instance of Error.



20
21
22
23
24
25
# File 'lib/nethttputils.rb', line 20

def initialize body, code = nil
  @code = code
  @body = body
  body = body[0...997] + "..." if body.size > 1000
  super "HTTP error ##{code.inspect} #{body}"
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



19
20
21
# File 'lib/nethttputils.rb', line 19

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end