Exception: CloudApp::ResponseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cloudapp/response_error.rb

Overview

Error raised on a bad response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(res) ⇒ CloudApp::ResponseError

Instantiate an instance of CloudApp::ResponseError

Only used internally

Parameters:



14
15
16
17
18
# File 'lib/cloudapp/response_error.rb', line 14

def initialize(res)
  @response = res.response
  @code     = res.code
  @errors   = parse_errors(res.parsed_response)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/cloudapp/response_error.rb', line 6

def code
  @code
end

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/cloudapp/response_error.rb', line 6

def errors
  @errors
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/cloudapp/response_error.rb', line 6

def response
  @response
end

Instance Method Details

#to_sString

Returns error code and message

Returns:

  • (String)


23
24
25
# File 'lib/cloudapp/response_error.rb', line 23

def to_s
  "#{code.to_s} #{response.msg}".strip
end