Class: RightScale::CloudApi::Parser::AWS::S3::ResponseError
- Inherits:
-
Object
- Object
- RightScale::CloudApi::Parser::AWS::S3::ResponseError
- Defined in:
- lib/cloud/aws/s3/parsers/response_error.rb
Overview
S3 response error
Class Method Summary collapse
-
.parse(response, options = {}) ⇒ String
Parses HTTP error message from a response body.
Class Method Details
.parse(response, options = {}) ⇒ String
Parses HTTP error message from a response body
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cloud/aws/s3/parsers/response_error.rb', line 52 def self.parse(response, ={}) body = response.body.to_s result = "#{response.code}" return result if body._blank? is_xml = response['content-type'].to_s[/xml/] || body[/\A<\?xml /] if is_xml hash = Utils::get_xml_parser_class([:xml_parser]).parse(body) error = hash["Error"] result << (error ? ": #{error['Code']}: #{error['Message']} (RequestID: #{error['RequestId']})" : ": #{body}") else result << ": #{body}" end result end |