Catching Exceptions from the PHP Client Library


If you are using the PHP client library and see an error like "Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400' in ..." What you should really do is surround your code in a try block and use a catch statement like this:
catch(Zend_Gdata_App_HttpException $exception) {
    echo "Error: " . $exception->getResponse()->getRawBody();
}
Usually this will print a more informative message describing the reason for failure.

No comments: