异步错误
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
由于 ExperimentService
包含一些异步操作,因此用于提取与这些操作相关的错误的机制与其他同步操作不同。
使用此错误报告机制的异步操作如下:
对于这些方法,API 会返回一个长时间运行的操作,您可以使用该操作请求有关异步操作状态的详细信息。完成后,长时间运行的操作将填充 error
和 response
字段。在 Google Ads API 中,该操作将始终使用 Empty
值填充 response
,如果存在 error
将指示可以从另一 API 调用检索完整的错误列表。
如果长时间运行的操作中返回了完整的错误列表,那么,如果您不跟踪异步进度,错误可能会丢失,而且响应结果可能比简单的轮询请求大。因此,长时间运行的操作将仅指示存在错误,要提取特定的错误,您必须使用 API 端点。
对于与这些基于实验的长时间运行的操作相关的错误,请使用 ExperimentService.ListExperimentAsyncErrors
。
传入实验的资源名称和页面大小,然后像浏览任何其他 Google Ads API 查询一样浏览结果。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-26。
[null,null,["最后更新时间 (UTC):2025-08-26。"],[[["\u003cp\u003eThe \u003ccode\u003eExperimentService\u003c/code\u003e uses a different error reporting mechanism for its asynchronous operations like scheduling and promoting experiments.\u003c/p\u003e\n"],["\u003cp\u003eAsynchronous operations return a longrunning operation; check its \u003ccode\u003eerror\u003c/code\u003e field to see if errors occurred during the operation.\u003c/p\u003e\n"],["\u003cp\u003eTo retrieve the full list of errors for an asynchronous experiment operation, use the \u003ccode\u003eExperimentService.ListExperimentAsyncErrors\u003c/code\u003e method with the experiment's resource name.\u003c/p\u003e\n"],["\u003cp\u003eInstead of including all errors in the initial response, this approach prevents potential data loss and keeps response sizes manageable.\u003c/p\u003e\n"]]],[],null,["# Asynchronous errors\n\nSince the[`ExperimentService`](/google-ads/api/reference/rpc/v21/ExperimentService) contains a few\nasynchronous operations, the mechanism for fetching errors related to these\noperations is different than for other synchronous operations.\n\nThe asynchronous operations that use this error reporting mechanism are:\n\n- [`ExperimentService.ScheduleExperiment`](/google-ads/api/reference/rpc/v21/ExperimentService/ScheduleExperiment)\n- [`ExperimentService.PromoteExperiment`](/google-ads/api/reference/rpc/v21/ExperimentService/PromoteExperiment)\n\nFor these methods, the API returns a [longrunning\noperation](/google-ads/api/reference/rpc/google.longrunning#google.longrunning.Operation)\nwhich you can use to request details on the status of the asynchronous\noperation. Upon completion, the longrunning operation will populate the `error`\nand `response` fields. In the Google Ads API, the operation will always populate the\n`response` with an `Empty` value, and the presence of `error` will indicate\nthat a full list of errors can be retrieved from another API call.\n\nIf the full list of errors were returned as part of the longrunning operation,\nthen there's a chance the errors might be lost if you don't follow up on the\nasynchronous progress, and the response may be larger than you might expect\nfrom a simple polling request. Therefore, the longrunning operation will only\nindicate that there are errors, and to fetch the specific errors you must use\nan API endpoint.\n\nFor errors relating to any of these experiment-based long running operations,\nuse\n[`ExperimentService.ListExperimentAsyncErrors`](/google-ads/api/reference/rpc/v21/ExperimentService/ListExperimentAsyncErrors).\n\nPass in the resource name of the experiment, and a page size, then page through\nthe results as you would for any other Google Ads API query."]]