Method: Aliyun::OSS::ServerError#initialize
- Defined in:
- lib/aliyun/oss/exception.rb
#initialize(response) ⇒ ServerError
Returns a new instance of ServerError.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/aliyun/oss/exception.rb', line 18 def initialize(response) @http_code = response.code @attrs = {'RequestId' => get_request_id(response)} doc = Nokogiri::XML(response.body) do |config| config. |= Nokogiri::XML::ParseOptions::NOBLANKS end rescue nil if doc and doc.root doc.root.children.each do |n| @attrs[n.name] = n.text end end @error_code = @attrs['Code'] = @attrs['Message'] @request_id = @attrs['RequestId'] end |