Exception: Qiniu::ResponseError

Inherits:
Exception
  • Object
show all
Defined in:
lib/qiniu/exceptions.rb

Direct Known Subclasses

RequestFailed

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, response = nil) ⇒ ResponseError

Returns a new instance of ResponseError.



11
12
13
14
# File 'lib/qiniu/exceptions.rb', line 11

def initialize(message, response = nil)
  @response = response
  super(message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/qiniu/exceptions.rb', line 9

def response
  @response
end

Instance Method Details

#http_bodyObject



20
21
22
# File 'lib/qiniu/exceptions.rb', line 20

def http_body
  @response.body if @response
end

#http_codeObject



16
17
18
# File 'lib/qiniu/exceptions.rb', line 16

def http_code
  @response.code.to_i if @response
end

#inspectObject



24
25
26
# File 'lib/qiniu/exceptions.rb', line 24

def inspect
  "#{message}: #{http_body}"
end