As wonderful as the Amazon S3 service is, sometimes for whatever reason there can be connectivity issues and the cURL request sent to AWS can come back with errors. Unfortunately Drupal catches all exceptions at a pretty high level and boots the user out to a nasty error screen. If you have a client using their CMS, uploading files and they get redirected to such an error, or just the "whoops something went wrong" page if you've disabled error display on screen, that's not very good.
It would be better if the Amazon S3 module had a means by which to catch these exceptions more gracefully, log the error details with watchdog and display a more friendly message to the user.
I'm testing possibilities of this with a site I'm using the module in. I'm going to try updating the stream_open method to wrap it's code in a try/catch statement to see if that does the trick. That's the first method always called after initialisation of the wrapper so I'm hoping that will catch all exceptions. If it doesn't, then I will try updating other methods as well that send calls through to the SDK until I've found all the places that need it.
I'll publish a patch if I find one that really works well, but otherwise will leave it in your capable hands to test and try different options yourselves.
Comment | File | Size | Author |
---|---|---|---|
Screen Shot 2014-05-02 at 3.21.26 PM.png | 54.95 KB | teknocat |
Comments
Comment #1
justafishThanks - I've added in exceptions to the wrapper on any calls to S3