-
Notifications
You must be signed in to change notification settings - Fork 979
Description
Hi,
I have a program that receives a report definition from the user and runs it on Adwords.
I've encountered a situation where the report failed and the exception is missing a good explanation for the failure, although this data exists in the headers of the response.
Example of the report: {"selector":{"fields":["AccountCurrencyCode"]},"reportType":"GEO_PERFORMANCE_REPORT","includeZeroImpressions":"false"}
I'm running the report_downloader.DownloadReportAsString
and getting the following error:
AdWordsReportError('AdWords report download failed with HTTP status code: 400',)
.
In the log I see the following line:
googleads.adwords.report_downloader: Request Summary: {'clientCustomerId': 'xxx', 'includeZeroImpressions': 'false', 'server': 'adwords.google.com', 'skipColumnHeader': 'True', 'skipReportHeader': 'True', 'skipReportSummary': 'True', 'isError': True, 'errorMessage': '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportDownloadError><ApiError><type>SelectorError.MISSING_FIELDS</type><trigger>Must choose at least 1 field from the group [CountryCriteriaId]</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>'}
So I know we have more data about the error.
After digging in the code I found that the error is on the function: _DownloadReportAsStream
on the line: response = self.url_opener.open(request)
.
The logger writes the exception from the function _ExtractRequestSummaryFields
but the exception is using the function _ExtractError
.
Is there a way to add this kind of information to the AdWordsReportError
?