处理请求错误

Maps Datasets API 会返回错误消息作为 响应。例如,如果您省略了 请求,或者如果令牌已过期,则请求会返回:

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential.
    Expected OAuth 2 access token, login cookie or other valid authentication credential.
    See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "CREDENTIALS_MISSING",
        "domain": "googleapis.com",
        "metadata": {
          "method": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasets",
          "service": "mapsplatformdatasets.googleapis.com"
        }
      }
    ]
  }
}

如果您在创建displayName 则请求会返回以下内容:

{
  "error": {
    "code": 400,
    "message": "display_name: Display name must be provided",
    "status": "INVALID_ARGUMENT"
  }
}

如果您传递的数据集 ID 无效,则请求会返回以下内容:

{
  "error": {
    "code": 404,
    "message": "Dataset not found",
    "status": "NOT_FOUND"
  }
}

如需详细了解错误和错误处理,请参阅 错误