Exception: Qiniu::RS::ResponseError

Inherits:
Exception
  • Object
show all
Defined in:
lib/qiniu/rs/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.



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

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

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#http_bodyObject



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

def http_body
  @response.body if @response
end

#http_codeObject



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

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

#inspectObject



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

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