ZF-9436: Allow error handling for users of Zend_Service_Amazon_S3
Description
I've used Zend's S3 class quite a bit, and have always been annoyed that when its not working, it's difficult to figure out what went wrong. There might be a way to do it, but if there is, it's poorly documented.
For example, I recently had a case where a {{getObject}} call was returning false on one of my servers, while the code worked just fine on others. This was very confusing to me, which was compounded by the fact that there's no way to get the error, or even the response object (again, that I know of). What I ended up doing was going into the {{getObject}} method and {{var_dump}} ing the response object. This worked, and helped me find my error, but in a production system is obviously not a viable way of handling errors. Imagine if this had happened on a deployed site, there would be no way for me to log what went wrong without hacking at the class itself.
What I would ideally like to see would be, anytime there's a response code other than 200 (in my case, it was a 403, and the issue ended up being that the server time was way off), an exception should be thrown with the content of the {{}} element. Here was my {{}} element:
RequestTimeTooSkewed
The difference between the request time and the current time is too large.900000
..snip..
Wed, 17 Mar 2010 01:05:11 +00002010-03-16T18:05:27Z
Even if throwing exceptions isn't a viable solution (I realize it could be a pretty major change for your users), maybe a {{getLastError}} method could be added, or even just a way of obtaining the response object.
Comments
No comments to display