Exception: CFoundry::APIError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- CFoundry::APIError
- Includes:
- TraceHelpers
- Defined in:
- lib/cfoundry/errors.rb
Overview
Exception representing errors returned by the API.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(description = nil, error_code = nil, request = nil, response = nil) ⇒ APIError
constructor
Create an APIError with a given request and response.
- #request_trace ⇒ Object
- #response_trace ⇒ Object
-
#to_s ⇒ Object
Exception message.
Constructor Details
#initialize(description = nil, error_code = nil, request = nil, response = nil) ⇒ APIError
Create an APIError with a given request and response.
79 80 81 82 83 84 |
# File 'lib/cfoundry/errors.rb', line 79 def initialize(description = nil, error_code = nil, request = nil, response = nil) @response = response @request = request @error_code = error_code || (response ? response[:status] : nil) @description = description || parse_description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
76 77 78 |
# File 'lib/cfoundry/errors.rb', line 76 def description @description end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
76 77 78 |
# File 'lib/cfoundry/errors.rb', line 76 def error_code @error_code end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
76 77 78 |
# File 'lib/cfoundry/errors.rb', line 76 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
76 77 78 |
# File 'lib/cfoundry/errors.rb', line 76 def response @response end |
Class Method Details
.error_classes ⇒ Object
71 72 73 |
# File 'lib/cfoundry/errors.rb', line 71 def error_classes @error_classes ||= {} end |
Instance Method Details
#request_trace ⇒ Object
91 92 93 |
# File 'lib/cfoundry/errors.rb', line 91 def request_trace super(request) end |
#response_trace ⇒ Object
95 96 97 |
# File 'lib/cfoundry/errors.rb', line 95 def response_trace super(response) end |
#to_s ⇒ Object
Exception message.
87 88 89 |
# File 'lib/cfoundry/errors.rb', line 87 def to_s "#{error_code}: #{description}" end |