class Aws::Plugins::S3Http200Errors::Handler
def call(context)
def call(context) @handler.call(context).on(200) do |response| if error = check_for_error(context) context.http_response.status_code = 500 response.data = nil response.error = error end end end
def check_for_error(context)
def check_for_error(context) xml = context.http_response.body_contents if xml.match(/<Error>/) error_code = xml.match(/<Code>(.+?)<\/Code>/)[1] error_message = xml.match(/<Message>(.+?)<\/Message>/)[1] S3::Errors.error_class(error_code).new(context, error_message) end end