Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HandleKeywordPolicyViolations not getting the right exception #1012

Open
SeriousJ55 opened this issue Apr 24, 2024 · 4 comments
Open

HandleKeywordPolicyViolations not getting the right exception #1012

SeriousJ55 opened this issue Apr 24, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request triage Need triage

Comments

@SeriousJ55
Copy link

The code in examples/ErrorHandling/HandleKeywordPolicyViolations.php doesn't work because policy violations of a keyword are thrown as ApiExceptions and not as GoogleAdsExceptions.

For instance, here are the first lines an error received for a policy violation:

object(Google\ApiCore\ApiException)#28230 (11) { ["message":protected]=> string(3883) "{ "message": "Request contains an invalid argument.", "code": 3, "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure", "errors": [ { "errorCode": { "policyViolationError": "POLICY_ERROR" }, "message": "A policy was violated. See PolicyViolationDetails for more detail.", "trigger": { "stringValue": "Atestado para Comprovar Rela\u00e7\u00e3o de Prestador de Servi\u00e7os" }, "location": { "fieldPathElements": [ { "fieldName": "operations", "index": 0 }, { "fieldName": "create" }, { "fieldName": "keyword" }, { "fieldName": "text" } ] }, "details": { "policyViolationDetails": { "externalPolicyDescription": [...]

As you can see, this is an ApiException. So I can't access the associated policyViolationDetailsKey and thus can't ask for an exemption.

What am I missing?

@SeriousJ55 SeriousJ55 added bug Something isn't working triage Need triage labels Apr 24, 2024
@fiboknacky
Copy link
Member

There might be some changes recently that we aren't aware of. Let me look into this and will update this thread when I have more clues.

@fiboknacky
Copy link
Member

Did you use REST, not gRPC?

@SeriousJ55
Copy link
Author

SeriousJ55 commented Jun 4, 2024 via email

@fiboknacky
Copy link
Member

Ah. OK. REST cannot handle errors as well as gRPC right now. We have this in our feature request list, but it's going to take some time to finish it.

@fiboknacky fiboknacky self-assigned this Jun 5, 2024
@fiboknacky fiboknacky added the enhancement New feature or request label Jun 5, 2024
@fiboknacky fiboknacky removed the bug Something isn't working label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage Need triage
Projects
None yet
Development

No branches or pull requests

2 participants