I am trying to handle keyword policy violation error in google ads api. I am trying the given example. https://github.com/googleads/google-ads-php/blob/main/examples/ErrorHandling/HandleKeywordPolicyViolations.php

They say the error will be thrown in GoogleAdsException and it can be handled with the googleAdsException object. But I always get the error in ApiException.

Can anyone help me? Thank you in advance.

Tag:google-ads-api, exception, error-handling

2 comments.

  1. Heiko

    it's been a while, but I just stumbled across this. I had implemented it exactly as Google suggested. It worked just fine.

    Now it no longer works. The only difference is that now I don't have grpc and protobuf compiled as an extension for PHP, but have pulled the packages in via composer as PHP source. And look, there is only the GoogleApiException. However, this contains all the necessary data, only I have to write a different handling.

    Conclusion: I suspect it's because the PHP packages via composer give different results than the compiled PHP extensions.

    I can't tell more precisely at the moment, because I can't test compiled extensions here right now.

    1. Heiko

      Ok, I got my macOS doing what I want and so I was able to test this: YES it depends wether you use the compiled grpc PHP extension (there you have everything google described) or the composer package (there it is reduced to the GoogleApiException and nothing else)!

Add a new comment.