Exception: CFoundry::APIError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- CFoundry::APIError
- Defined in:
- lib/cfoundry/errors.rb
Overview
Exception representing errors returned by the API.
Direct Known Subclasses
Class Attribute Summary collapse
-
.description ⇒ Object
readonly
Generic description for the exception.
-
.error_code ⇒ Object
readonly
Generic error code for the exception.
Instance Method Summary collapse
-
#description ⇒ Object
A description of the error.
-
#error_code ⇒ Object
A number representing the error.
-
#initialize(error_code = nil, description = nil) ⇒ APIError
constructor
Create an APIError with a given error code and description.
-
#to_s ⇒ Object
Exception message.
Constructor Details
#initialize(error_code = nil, description = nil) ⇒ APIError
Create an APIError with a given error code and description.
20 21 22 23 |
# File 'lib/cfoundry/errors.rb', line 20 def initialize(error_code = nil, description = nil) @error_code = error_code @description = description end |
Class Attribute Details
.description ⇒ Object (readonly)
Generic description for the exception.
9 10 11 |
# File 'lib/cfoundry/errors.rb', line 9 def description @description end |
.error_code ⇒ Object (readonly)
Generic error code for the exception.
6 7 8 |
# File 'lib/cfoundry/errors.rb', line 6 def error_code @error_code end |
Instance Method Details
#description ⇒ Object
A description of the error.
31 32 33 |
# File 'lib/cfoundry/errors.rb', line 31 def description @description || self.class.description end |
#error_code ⇒ Object
A number representing the error.
26 27 28 |
# File 'lib/cfoundry/errors.rb', line 26 def error_code @error_code || self.class.error_code end |
#to_s ⇒ Object
Exception message.
36 37 38 39 40 41 42 |
# File 'lib/cfoundry/errors.rb', line 36 def to_s if error_code "#{error_code}: #{description}" else description end end |