Class: ConfigureS3Website::ErrorParser

Inherits:
Object
  • Object
show all
Defined in:
lib/configure-s3-website/http_helper.rb

Class Method Summary collapse

Class Method Details

.create_error(amazon_error_xml) ⇒ Object



82
83
84
85
86
87
88
89
# File 'lib/configure-s3-website/http_helper.rb', line 82

def self.create_error(amazon_error_xml)
  error_code = amazon_error_xml.delete('\n').match(/<Code>(.*?)<\/Code>/)[1]
  begin
    Object.const_get("#{error_code}Error").new
  rescue NameError
    GenericError.new(amazon_error_xml)
  end
end