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.
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"
}
]
}