marcel / aws-s3

AWS-S3 is a Ruby implementation of Amazon's S3 REST API
http://amazon.rubyforge.org
MIT License
774 stars 461 forks source link

`.error.raise` on 403 Forbidden responses causes method_missing blowup #115

Open eternaleye opened 8 years ago

eternaleye commented 8 years ago

When attempting to find a bucket, a 403 response's error member, when raised, explodes due to a missing message member.

/usr/local/share/gems/gems/aws-s3-0.6.3/lib/aws/s3/error.rb:63:in `method_missing': undefined local variable or method `message' for #<AWS::S3::Error:0x0000000248e840> (NameError)
        from /usr/local/share/gems/gems/aws-s3-0.6.3/lib/aws/s3/error.rb:38:in `raise'
        from /usr/local/share/gems/gems/aws-s3-0.6.3/lib/aws/s3/base.rb:72:in `request'
        from /usr/local/share/gems/gems/aws-s3-0.6.3/lib/aws/s3/base.rb:88:in `get'
        from /usr/local/share/gems/gems/aws-s3-0.6.3/lib/aws/s3/bucket.rb:102:in `find'
        from write_file.rb:101:in `<main>'

The 403 error itself was made more difficult to debug by this, as we had to step down a ways into aws-s3 to find it at all.

harrykas commented 8 years ago

My Ceph RadosGW service does not return 'message' element in error response, so I've replaced it with 'code' element and created pull request: https://github.com/marcel/aws-s3/pull/116