MutateResult, ApiError with empty trigger

51 views
Skip to first unread message

Lukas Lukac

unread,
Sep 25, 2017, 4:46:59 AM9/25/17
to AdWords API Forum
Hi,

I am trying to process mutate results and log all the errors returned from a BatchJob but some of the errors return empty Trigger string and I don't know to which operation they belong.

I am providing one of the failed responses for BatchJob: 571787226:

class Google\AdsApi\AdWords\v201705\cm\MutateResult#685 (3) {


  protected $result =>


  NULL


  protected $errorList =>


  class Google\AdsApi\AdWords\v201705\cm\ErrorList#684 (1) {


    protected $errors =>


    array(3) {


      [0] =>


      class Google\AdsApi\AdWords\v201705\cm\DistinctError#606 (7) {


        protected $reason =>


        string(17) "DUPLICATE_ELEMENT"


        protected $fieldPath =>


        string(14) "operations[10]"


        protected $fieldPathElements =>


        array(1) {


          [0] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#697 (2) {


            protected $field =>


            string(10) "operations"


            protected $index =>


            int(10)


          }


        }


        protected $trigger =>


        string(0) ""


        protected $errorString =>


        string(31) "DistinctError.DUPLICATE_ELEMENT"


        protected $ApiErrorType =>


        string(13) "DistinctError"


        private $parameterMap =>


        array(1) {


          'ApiError.Type' =>


          string(12) "ApiErrorType"


        }


      }


      [1] =>


      class Google\AdsApi\AdWords\v201705\cm\RangeError#705 (7) {


        protected $reason =>


        string(7) "TOO_LOW"


        protected $fieldPath =>


        string(38) "operations[10].operand.criterion.id.id"


        protected $fieldPathElements =>


        array(5) {


          [0] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#701 (2) {


            protected $field =>


            string(10) "operations"


            protected $index =>


            int(10)


          }


          [1] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#625 (2) {


            protected $field =>


            string(7) "operand"


            protected $index =>


            NULL


          }


          [2] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#698 (2) {


            protected $field =>


            string(9) "criterion"


            protected $index =>


            NULL


          }


          [3] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#699 (2) {


            protected $field =>


            string(2) "id"


            protected $index =>


            NULL


          }


          [4] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#704 (2) {


            protected $field =>


            string(2) "id"


            protected $index =>


            NULL


          }


        }


        protected $trigger =>


        string(0) ""


        protected $errorString =>


        string(18) "RangeError.TOO_LOW"


        protected $ApiErrorType =>


        string(10) "RangeError"


        private $parameterMap =>


        array(1) {


          'ApiError.Type' =>


          string(12) "ApiErrorType"


        }


      }


      [2] =>


      class Google\AdsApi\AdWords\v201705\cm\RangeError#711 (7) {


        protected $reason =>


        string(7) "TOO_LOW"


        protected $fieldPath =>


        string(38) "operations[10].operand.criterion.id.id"


        protected $fieldPathElements =>


        array(5) {


          [0] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#638 (2) {


            protected $field =>


            string(10) "operations"


            protected $index =>


            int(10)


          }


          [1] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#707 (2) {


            protected $field =>


            string(7) "operand"


            protected $index =>


            NULL


          }


          [2] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#674 (2) {


            protected $field =>


            string(9) "criterion"


            protected $index =>


            NULL


          }


          [3] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#690 (2) {


            protected $field =>


            string(2) "id"


            protected $index =>


            NULL


          }


          [4] =>


          class Google\AdsApi\AdWords\v201705\cm\FieldPathElement#710 (2) {


            protected $field =>


            string(2) "id"


            protected $index =>


            NULL


          }


        }


        protected $trigger =>


        string(0) ""


        protected $errorString =>


        string(18) "RangeError.TOO_LOW"


        protected $ApiErrorType =>


        string(10) "RangeError"


        private $parameterMap =>


        array(1) {


          'ApiError.Type' =>


          string(12) "ApiErrorType"


        }


      }


    }


  }


  protected $index =>


  int(10)


}


My current code to get all the errors from a response looks like:

/** @var MutateResult $mutateResult */
foreach ($mutateResults as $mutateResult) {
    /** @var ApiError $error */
    foreach ($mutateResult->getErrorList()->getErrors() as $error) {
        // Error for operation 10 has a an empty Trigger attribute for some reason
        if ($mutateResult->getIndex() == 10) {
            var_dump($mutateResult);
            var_dump($mutateResult->getErrorList()->getErrors());
            var_dump($error);
            die;
        }
        $message = sprintf(
            "  Operation [%d] %s failed due to %s - %s",
            $mutateResult->getIndex(),
            $error->getTrigger(),
            $error->getErrorString(),
            $error->getApiErrorType()
        );

        $this->processorLogger->error($message, $chunk);
    }
}

How can I figure out what caused this error?

I want to achieve the output I achieved for operation 2:

Operation [2] CampaignId: 389 failed due to EntityNotFound.INVALID_ID - EntityNotFound


In this case the trigger is clear: "CampaignId: 389" is not found in AdWords.

Lukas Lukac

unread,
Sep 25, 2017, 5:12:38 AM9/25/17
to AdWords API Forum
And here is also a link to the list of operations I am uploading to AdWords. https://gist.github.com/EnchanterIO/ccbc1d0f9b99bd2c6adc69027c147dd6

Shwetha Vastrad (AdWords API Team)

unread,
Sep 25, 2017, 1:07:18 PM9/25/17
to AdWords API Forum
Hi Lukas, 

Thank you for providing the details. From the MutateResult in the batch job's downloadUrl, I can see that the Operation at index 10 encountered 3 errors. You can use the fieldPath string or fieldPathElements in your error handling to get the field name and index that caused an error. I'll get in touch with the team to check why the trigger wasn't returned in the response. I see that this is a SET operation with the criterionId set to 0. You need to check your code to see if the criterionId is being passed correctly. 

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages