Exception: Fog::Rackspace::Errors::ServiceError
- Inherits:
-
Errors::Error
- Object
- StandardError
- Errors::Error
- Fog::Rackspace::Errors::ServiceError
- Defined in:
- lib/fog/rackspace.rb
Direct Known Subclasses
Compute::RackspaceV2::ServiceError, BlockStorage::ServiceError, Databases::ServiceError, BadRequest, Conflict, InternalServerError, NotFound, ServiceUnavailable, LoadBalancers::ServiceError
Instance Attribute Summary collapse
-
#response_data ⇒ Object
readonly
Returns the value of attribute response_data.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Attributes inherited from Errors::Error
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#response_data ⇒ Object (readonly)
Returns the value of attribute response_data.
14 15 16 |
# File 'lib/fog/rackspace.rb', line 14 def response_data @response_data end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
14 15 16 |
# File 'lib/fog/rackspace.rb', line 14 def status_code @status_code end |
Class Method Details
.slurp(error) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/rackspace.rb', line 20 def self.slurp(error) data = nil = nil status_code = nil if error.response status_code = error.response.status unless error.response.body.empty? data = Fog::JSON.decode(error.response.body) = data.values.first ? data.values.first['message'] : data['message'] end end new_error = super(error, ) new_error.instance_variable_set(:@response_data, data) new_error.instance_variable_set(:@status_code, status_code) new_error end |
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/fog/rackspace.rb', line 16 def to_s status_code ? "[HTTP #{status_code}] #{super}" : super end |