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



59
60
61
62
63
64
65
66
# File 'lib/configure-s3-website/http_helper.rb', line 59

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