Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3::Bucket error handing on bucket creation #136

Closed
colby-swandale opened this issue Jan 7, 2015 · 1 comment
Closed

S3::Bucket error handing on bucket creation #136

colby-swandale opened this issue Jan 7, 2015 · 1 comment

Comments

@colby-swandale
Copy link
Contributor

Hey Guys,

After going through the source code and documentation i cannot see an API for the S3::Bucket class available to see if any errors were returned from AWS.

ie: this is an inspection on a bucket that was successfully created

#<Aws::S3::Bucket:0x007fb0de8a5b60 @s3=#<Aws::S3:0x007fb0de8c4880 @interface=#<Aws::S3Interface:0x007fb0de8c4830 @params={:server=>"s3.amazonaws.com", :port=>443, :service=>"", :protocol=>"https", :api_version=>nil, :connection_mode=>:per_request}, @aws_access_key_id="xxxxxxxxxxxx", @aws_secret_access_key="xxxxxxxxxxxxx", @logger=#<Logger:0x007fb0de8c4650 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x007fb0de8c45d8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007fb0de8c4588 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007fb0de8c4560 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fb0de8c4510>>>>, @error_handler=nil, @cache={}, @signature_version="2", @last_request=#<Net::HTTP::Put PUT>, @last_response=#<Net::HTTPOK 200 OK readbody=true>>>, @name="mytestsite.test.io", @owner=nil, @creation_date=nil>

And again when i try to create the same bucket in AWS. You can see it returns a conflict HTTP header.

#<Aws::S3::Bucket:0x007fb0de8670e0 @s3=#<Aws::S3:0x007fb0de8c4880 @interface=#<Aws::S3Interface:0x007fb0de8c4830 @params={:server=>"s3.amazonaws.com", :port=>443, :service=>"", :protocol=>"https", :api_version=>nil, :connection_mode=>:per_request}, @aws_access_key_id="xxxxxxxxxxxxxx", @aws_secret_access_key="xxxxxxxxxxxxxx", @logger=#<Logger:0x007fb0de8c4650 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x007fb0de8c45d8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007fb0de8c4588 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007fb0de8c4560 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fb0de8c4510>>>>, @error_handler=nil, @cache={}, @signature_version="2", @last_request=#<Net::HTTP::Put PUT>, @last_response=#<Net::HTTPConflict 409 Conflict readbody=true>, @last_errors=[["BucketAlreadyOwnedByYou", "Your previous request to create the named bucket succeeded and you already own it."]], @last_request_id=nil>>, @name="mytestsite.test.io", @owner=nil, @creation_date=nil>

Upon inspection can see an instance variable @last_response contains the http result and would be great if i could get access to that in some way.

Did i missing something here or should i work on a PR?

Thanks.

@colby-swandale colby-swandale changed the title S3::Bucket provides error handing on bucket creation S3::Bucket error handing on bucket creation Jan 7, 2015
@treeder
Copy link
Member

treeder commented Jan 7, 2015

Hey @colby-swandale , a PR would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants