Class: Fog::UKCloud::Errors::ServiceError
- Inherits:
-
Errors::Error
- Object
- Errors::Error
- Fog::UKCloud::Errors::ServiceError
- Defined in:
- lib/fog/ukcloud/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Class Method Summary collapse
Instance Attribute Details
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
5 6 7 |
# File 'lib/fog/ukcloud/errors.rb', line 5 def status_code @status_code end |
Class Method Details
.slurp(error, service = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fog/ukcloud/errors.rb', line 7 def self.slurp(error, service=nil) status_code = nil if error.response status_code = error.response.status unless error.response.body.empty? begin document = Nokogiri::XML(error.response.body) = document.xpath('//error').text rescue => e Fog::Logger.warning("Received exception '#{e}' while decoding>> #{error.response.body}") = error.response.body end end end new_error = super(error, ) new_error.instance_variable_set(:@status_code, status_code) new_error end |