{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1391","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1391/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1391/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1391/events","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-java/issues/1391","id":188657182,"number":1391,"title":"BigQueryException when patching a table does not contain propagated error codes","user":{"login":"mtagle","id":2165162,"avatar_url":"https://avatars.githubusercontent.com/u/2165162?v=3","gravatar_id":"","url":"https://api.github.com/users/mtagle","html_url":"https://github.com/mtagle","followers_url":"https://api.github.com/users/mtagle/followers","following_url":"https://api.github.com/users/mtagle/following{/other_user}","gists_url":"https://api.github.com/users/mtagle/gists{/gist_id}","starred_url":"https://api.github.com/users/mtagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtagle/subscriptions","organizations_url":"https://api.github.com/users/mtagle/orgs","repos_url":"https://api.github.com/users/mtagle/repos","events_url":"https://api.github.com/users/mtagle/events{/privacy}","received_events_url":"https://api.github.com/users/mtagle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-11T00:37:27Z","updated_at":"2016-11-11T11:29:20Z","closed_at":null,"body":"It looks like there are other flows that also don’t propagate error codes, but this particular one is what I saw.\r\n\r\nI noticed this when I was updating a table.  Our code has retry logic if the returned BigQueryException has an error code of 403.\r\n\r\nrelevant code lines:\r\nhttps://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/DefaultBigQueryRpc.java#L206\r\n\r\nhttps://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/DefaultBigQueryRpc.java#L93\r\n\r\nGoogleJsonResponseException is a subclass of IOException, but the error code there isn't ending up in the wrapping BigQueryException.\r\n\r\nThe part of my stack trace that lead me to this conclusion:\r\n\r\n```\r\nCaused by: com.google.cloud.bigquery.BigQueryException: Exceeded rate limits: Your table exceeded quota for table.insert or table.update per table. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors\r\n\r\nat com.google.cloud.bigquery.spi.DefaultBigQueryRpc.translate(DefaultBigQueryRpc.java:93)\r\nat com.google.cloud.bigquery.spi.DefaultBigQueryRpc.patch(DefaultBigQueryRpc.java:218)\r\nat com.google.cloud.bigquery.BigQueryImpl$10.call(BigQueryImpl.java:329)\r\nat com.google.cloud.bigquery.BigQueryImpl$10.call(BigQueryImpl.java:326)\r\nat com.google.cloud.RetryHelper.doRetry(RetryHelper.java:179)\r\nat com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:244)\r\nat com.google.cloud.bigquery.BigQueryImpl.update(BigQueryImpl.java:325)\r\nat com.wepay.kafka.connect.bigquery.SchemaManager.updateSchema(SchemaManager.java:57)\r\nat com.wepay.kafka.connect.bigquery.write.row.AdaptiveBigQueryWriter.performWriteRequest(AdaptiveBigQueryWriter.java:86)\r\nat com.wepay.kafka.connect.bigquery.write.row.BigQueryWriter.writeRows(BigQueryWriter.java:158) <— catching the 403 was expected to happen around here.\r\nat com.wepay.kafka.connect.bigquery.write.batch.DynamicBatchWriter.seekingWriteAll(DynamicBatchWriter.java:131)\r\n... 7 more\r\nCaused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden\r\n{\r\n  \"code\" : 403,\r\n  \"errors\" : [ {\r\n    \"domain\" : \"global\",\r\n    \"location\" : \"table.write\",\r\n    \"locationType\" : \"other\",\r\n    \"message\" : \"Exceeded rate limits: Your table exceeded quota for table.insert or table.update per table. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors\",\r\n    \"reason\" : \"rateLimitExceeded\"\r\n  } ],\r\n  \"message\" : \"Exceeded rate limits: Your table exceeded quota for table.insert or table.update per table. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors\"\r\n}\r\nat com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)\r\nat com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)\r\nat com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)\r\nat com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)\r\nat com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065)\r\nat com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)\r\nat com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)\r\nat com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)\r\nat com.google.cloud.bigquery.spi.DefaultBigQueryRpc.patch(DefaultBigQueryRpc.java:213)\r\n... 16 more\r\n```"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/comments/259938490","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-java/issues/1391#issuecomment-259938490","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1391","id":259938490,"user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"created_at":"2016-11-11T11:29:20Z","updated_at":"2016-11-11T11:29:20Z","body":"Hi @mtagle!\r\n\r\nI am not able to reproduce this on the latest version of `google-cloud` (0.5.1). Which version are you using?\r\n\r\nI tried the following code:\r\n```java\r\nString tableName = \"test_update_table\";\r\nStandardTableDefinition tableDefinition = StandardTableDefinition.of(TABLE_SCHEMA);\r\nTableInfo tableInfo = TableInfo.of(TableId.of(DATASET, tableName), tableDefinition);\r\nTable createdTable = bigquery.create(tableInfo);\r\nassertNotNull(createdTable);\r\nfor (int i = 0; i < 1001; i++) {\r\n  try {\r\n    Table updatedTable =\r\n      bigquery.update(tableInfo.toBuilder().setDescription(\"newDescription\").build());\r\n    } catch (BigQueryException ex) {\r\n    System.out.println(\"MESSAGE IS \" + ex.getMessage());\r\n    System.out.println(\"REASON IS \" + ex.getReason());\r\n    System.out.println(\"ERROR IS \" + ex.getError());\r\n    System.out.println(\"CODE IS \" + ex.getCode());\r\n    break;\r\n  }\r\n}\r\n```\r\nAnd I get the following output:\r\n```\r\nMESSAGE IS Exceeded rate limits: Your table exceeded quota for table.insert or table.update per table. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors\r\nREASON IS rateLimitExceeded\r\nERROR IS BigQueryError{reason=rateLimitExceeded, location=table.write, message=Exceeded rate limits: Your table exceeded quota for table.insert or table.update per table. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors}\r\nCODE IS 403\r\n```\r\n\r\nAs you can see `CODE` is correctly populated."}}
{"actor":{"display_login":"mziccard"}}