Not able to catch error when guzzle fails

230 views
Skip to first unread message

cv

unread,
Feb 1, 2021, 3:45:19 AM2/1/21
to AdWords API and Google Ads API Forum

Hi,


When there error like this or guzzle fails, try catch is not able to capture errors.

I am using PHP client library in google ads v6.

Type:        GuzzleHttp\Exception\ClientException

Message:     Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:

{

  "error": "invalid_grant",

  "error_description": "Account has been deleted"

}


Filename:    /google-ads-php/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php

Line Number: 113


Thanks,


Google Ads API Forum Advisor Prod

unread,
Feb 1, 2021, 3:39:34 PM2/1/21
to chirag....@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out. “Account has been deleted” indicates that the account that you used to generate the refresh token has been deleted. You could recreate the OAuth2 credentials using a valid Google Ads account and try the API call again.

Thanks and regards,
Xiaoming, Google Ads API Team
 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2BcdBa:ref

cv

unread,
Feb 1, 2021, 11:55:09 PM2/1/21
to AdWords API and Google Ads API Forum
Hello Xiaoming,

Yes, that I am able to know but in this case I wanted to catch those errors so that my cronjobs or data fetch part not interrupted and gone through other accounts and capture those errors for error log i managed.

Thanks,

Google Ads API Forum Advisor Prod

unread,
Feb 2, 2021, 2:46:28 PM2/2/21
to chirag....@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out. You could refer to this code snippet on how to handle the GoogleAdsException and ApiException. For the exceptions related to the Guzzle library, please refer to their documentation or reach out to the library owner to get further assistance.



Thanks and regards,
Xiaoming, Google Ads API Team
 

Reply all
Reply to author
Forward
0 new messages