I'm using the php library v15 in a laravel application.I'm trying to catch 
exceptions and request policy exemptions like it is shown in the keywords 
example in the github repo. however, I'm throwing an ApiException NOT a 
GoogleAdsException. I've included an example of what my exception looks 
like. How do I create a GoogleAdsException from the ApiException so I can 
work with that instead of the ApiException? Any advice would be helpful.

Thanks!!

Google\ApiCore\ApiException: {
    "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": "3012944502"
                    },
                    "location": {
                        "fieldPathElements": [
                            {
                                "fieldName": "operations",
                                "index": 2
                            },
                            {
                                "fieldName": "create"
                            },
                            {
                                "fieldName": "keyword"
                            },
                            {
                                "fieldName": "text"
                            }
                        ]
                    },
                    "details": {
                        "policyViolationDetails": {
                            "externalPolicyDescription": "Remove any phone 
number in the ad text. If you want customers to call you, consider using 
call extensions or call-only ads.",
                            "key": {
                                "policyName": "PHONE_NUMBER_IN_AD_TEXT",
                                "violatingText": "3012944502"
                            },
                            "externalPolicyName": "Phone number in ad text",
                            "isExemptible": true
                        }
                    }
                },
                {
                    "errorCode": {
                        "criterionError": "KEYWORD_TEXT_TOO_LONG"
                    },
                    "message": "Keyword text should be less than 80 chars.",
                    "trigger": {
                        "stringValue": 
"MKD090B-047-KP1-KNMKD090B-047-KP1-KNMKD090B-047-KP1-KNMKD090B-047-KP1-KNMKD090B-047-KP1-KN"
                    },
                    "location": {
                        "fieldPathElements": [
                            {
                                "fieldName": "operations",
                                "index": 3
                            },
                            {
                                "fieldName": "create"
                            },
                            {
                                "fieldName": "keyword"
                            },
                            {
                                "fieldName": "text"
                            }
                        ]
                    }
                }
            ],
            "requestId": "uzgE-DmswM1KKYuAIvyP7Q"
        }
    ]
}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/5ce28c10-9a94-4083-9d39-0380fe930d77n%40googlegroups.com.

Reply via email to