googleads / googleads-perl-lib

AdWords API Perl Client Library
Apache License 2.0
5 stars 19 forks source link

Google::Ads::Common::ErrorUtils::get_source_operation_index does not always return the correct index #13

Closed pickardj79 closed 8 years ago

pickardj79 commented 8 years ago

It looks like sometimes the fieldPath field of error objects sometimes contains multiple levels of operations. This causes Google::Ads::Common::ErrorUtils::get_source_operation_index to return an index of 0 when it should be non-zero.

E.g.- an expected example (from the perl debugger):

DB<1015> x $errorList
0  Google::Ads::AdWords::v201509::ErrorList=SCALAR(0x7f51b13dff98)
   -> 20806
   DB<1016> p $errorList
<errors xsi:type="EntityNotFound" ><fieldPath>operations[2].operand.criterion.id</fieldPath><trigger>CriterionId{id=45282000}</trigger><errorString>EntityNotFound.INVALID_ID</errorString><ApiError.Type>EntityNotFound</ApiError.Type><reason>INVALID_ID</reason></errors>

  DB<1017> p $errorList->get_errors->get_fieldPath
operations[2].operand.criterion.id

For another run of the same test program gives a different fieldPath in the ErrorList object:

DB<1016> p $errorList
<errors xsi:type="EntityNotFound" ><fieldPath>operations[0].operations[2].operand.criterion.id</fieldPath><trigger>CriterionId{id=45282000}</trigger><errorString>EntityNotFound.INVALID_ID</errorString><ApiError.Type>EntityNotFound</ApiError.Type><reason>INVALID_ID</reason></errors>

  DB<1017> p $errorList->get_errors->get_fieldPath
operations[0].operations[2].operand.criterion.id

Google::Ads::Common::ErrorUtils::get_source_operation_index does a pattern match against the fieldPath: $error->get_fieldPath() =~ /^operations\[(\d+)\]/ and returns the matched number. So in the second case it finds 0 as the index, instead of correctly finding 2.

sundquist commented 8 years ago

Thanks for reporting this. I'll take a look into it.

Best, Nadine Sundquist, AdWords API Team

sundquist commented 8 years ago

Hello,

Are you using the BatchJobService or the MutateJobService when you're getting back the 2 operations (e.g. operations[0].operations[2]) in a row? I'm trying to narrow down if this is a problem that needs to be fixed at a deeper level in AdWords since it would affect more than just my library.

Thanks, Nadine, AdWords API Team

mcmillhj commented 8 years ago

Commenting for @pickardj79 This is from requests sent using the BatchJobService. We haven't seen this behavior with the MutateJobService. I can provide the full request/response exchange if that would help.

sundquist commented 8 years ago

Hi Hunter,

Thanks for responding so quickly. I just wanted to verify that it was in the new BatchJobService and not seen anywhere else. At the moment I don't need any additional information. I've filed an issue with the BatchJobService team, and I've emailed you directly (with AdWords API in the subject) so I have a thread to update as we resolve this issue. If you know the email address of @pickardj79 , please add the email as a CC to the email thread I started with you. I'm currently closing the issue here, since it's been determined that this is a deeper issue with the AdWords API, but I will keep the email thread I have with you going.

@pickardj79 If Hunter doesn't have your email address, please tell me, and I'll get your address to add to the thread I have going.

Thanks again for reporting this, Nadine, AdWords API Team