I want to get an exception that is thrown by the Google API by the PHP library , but for some reason throws a "Fatal Error: Unrecoverable exception" before reaching my catch block.
In my application, I have something like this:
try { $google_client->authenticate($auth_code); } catch (Exception $e) {
This is Google_Client authenticate () :
public function authenticate($code) { $this->authenticated = true; return $this->getAuth()->authenticate($code); }
authenticate($code) above Google_Auth_OAuth2 :: authenticate () , which at some point raises an exception:
throw new Google_Auth_Exception( sprintf( "Error fetching OAuth2 access token, message: '%s'", $decodedResponse ), $response->getResponseHttpCode() );
If I put the try / catch block into Google_Client authentication, it will catch the exception, but without it the program just dies, and does not reach the main try / catch block from my application.
As far as I know, this should not happen. Any ideas?
php exception-handling google-api-php-client
Schrute
source share