Hi,
Can anyone tell me how to handle errors on new Adwords API v201708?
Here is my code, I can not catch exception I've tried these possibilities.
My code is working fine but if there is an error I want to handle it.

Code:
$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();
    
    $session = (new 
AdWordsSessionBuilder())->fromFile()->withOAuth2Credential($oAuth2Credential)->enablePartialFailure()->build();

    $adWordsServices=new AdWordsServices();
    
    $managedCustomerService = $adWordsServices->get($session, 
ManagedCustomerService::class);

    $link = new ManagedCustomerLink();
    $link->setManagerCustomerId($managerid);
    $link->setClientCustomerId($customerid);
    $link->setLinkStatus(LinkStatus::PENDING);

    $linkop = new LinkOperation();    
    $linkop->setOperator(Operator::ADD);
    $linkop->setOperand($link);

    $operations = array($linkop);
    
    try{
    $result = $managedCustomerService->mutateLink($operations);
    }catch(AdwordsApiException $e){
        print_r($e);
        print_r($result->getPartialFailureErrors());
        
    }catch(Exception $e){
        print_r($e);
        print_r($result->getPartialFailureErrors());
        
    }catch(ApiException $e){
        print_r($e);
        print_r($result->getPartialFailureErrors());
        
    }

Error:

*Fatal error*: Uncaught exception 
'Google\AdsApi\AdWords\v201708\cm\ApiException' with message 
'[ManagedCustomerServiceError.ALREADY_INVITED_BY_THIS_MANAGER @ 
operations[0]]' in 
/var/www/adwords_api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php:39
 
Stack trace: #0 
/var/www/adwords_api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php(39):
 
ReflectionClass->newInstanceArgs(Array) #1 
/var/www/adwords_api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(165):
 
Google\AdsApi\Common\Util\Reflection->createInstance('Google\AdsApi\A...', 
'[ManagedCustome...') #2 
/var/www/adwords_api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(130):
 
Google\AdsApi\Common\AdsSoapClient->parseApiExceptionFromSoapFault(Object(SoapFault))
 
#3 
/var/www/adwords_api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/v201708/mcm/ManagedCustomerService.php(185):
 
Google\AdsApi\Common\AdsSoapClient->__soapCall('mutateLink', Array in 
*/var/www/adwords_api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php*
 
on line *39*



Thanks.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/466b263c-747c-463f-9a91-38b01c865093%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to