Exception: VWorkApp::ResponseError
- Inherits:
-
StandardError
- Object
- StandardError
- VWorkApp::ResponseError
- Defined in:
- lib/vworkapp_ruby/base/response_error.rb
Overview
Error raised on a bad response
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(res) ⇒ ResponseError
constructor
A new instance of ResponseError.
- #to_s ⇒ Object
Constructor Details
#initialize(res) ⇒ ResponseError
Returns a new instance of ResponseError.
7 8 9 10 11 |
# File 'lib/vworkapp_ruby/base/response_error.rb', line 7 def initialize(res) @response = res.response @code = res.response.code @errors = extract_errors(res.parsed_response) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/vworkapp_ruby/base/response_error.rb', line 5 def code @code end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/vworkapp_ruby/base/response_error.rb', line 5 def errors @errors end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/vworkapp_ruby/base/response_error.rb', line 5 def response @response end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/vworkapp_ruby/base/response_error.rb', line 13 def to_s "#{code.to_s} - #{response.msg}:\n#{@errors && @errors.join("\n")}".strip end |