22.11. Catching Gdata Exceptions

The Zend_Gdata_App_Exception class is a base class for exceptions thrown by Zend_Gdata. You can catch any exception thrown by Zend_Gdata by catching Zend_Gdata_App_Exception.

try {
    $client =
        Zend_Gdata_ClientLogin::getHttpClient($username, $password);
} catch(Zend_Gdata_App_Exception $ex) {
    // Report the exception to the user
    die($ex->getMessage());
}

    

The following exception subclasses are used by Zend_Gdata:

You can use these exception subclasses to handle specific exceptions differently. See the API documentation for information on which exception subclasses are thrown by which methods in Zend_Gdata.

try {
    $client = Zend_Gdata_ClientLogin::getHttpClient($username,
                                                    $password,
                                                    $service);
} catch(Zend_Gdata_App_AuthException $authEx) {
    // The user's credentials were incorrect.
    // It would be appropriate to give the user a second try.
    ...
} catch(Zend_Gdata_App_HttpException $httpEx) {
    // Google Data servers cannot be contacted.
    die($httpEx->getMessage);}