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.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/1204fd2c-e9e2-4f54-ae1e-6a855a605ccd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • MutateResult, A... Lukas Lukac

Reply via email to