diff --git a/lib/sdb/right_sdb_interface.rb b/lib/sdb/right_sdb_interface.rb index 9d44106..14f5223 100644 --- a/lib/sdb/right_sdb_interface.rb +++ b/lib/sdb/right_sdb_interface.rb @@ -389,7 +389,7 @@ def create_domain_if_not_exist(ex, domain_name) # # items is an array of Aws::SdbInterface::Item.new(o.id, o.attributes, true) - def batch_put_attributes(domain_name, items) + def batch_put_attributes(domain_name, items, options={}) params = {'DomainName' => domain_name} i = 0 items.each do |item| @@ -399,7 +399,17 @@ def batch_put_attributes(domain_name, items) i += 1 end link = generate_request("BatchPutAttributes", params) - request_info(link, QSdbSimpleParser.new) + begin + request_info(link, QSdbSimpleParser.new, options) + rescue Aws::AwsError => ex + # puts "RESCUED in batch_put_attributes: " + $! + if options[:create_domain] && create_domain_if_not_exist(ex, domain_name) + options.delete(:create_domain) + batch_put_attributes(domain_name, items, options) + else + raise ex + end + end rescue Exception on_exception end