Title: PubSub topic.create method should raise a Conflict error instead of RetryError/GaxError when topic exists · Issue #3175 · googleapis/google-cloud-python · GitHub
Open Graph Title: PubSub topic.create method should raise a Conflict error instead of RetryError/GaxError when topic exists · Issue #3175 · googleapis/google-cloud-python
X Title: PubSub topic.create method should raise a Conflict error instead of RetryError/GaxError when topic exists · Issue #3175 · googleapis/google-cloud-python
Description: Following the documentation from PubSub site if you run the example 2x it will generate the error: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with (Stat...
Open Graph Description: Following the documentation from PubSub site if you run the example 2x it will generate the error: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_Rend...
X Description: Following the documentation from PubSub site if you run the example 2x it will generate the error: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_R...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/3175
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PubSub topic.create method should raise a Conflict error instead of RetryError/GaxError when topic exists","articleBody":"Following the [documentation from PubSub site](https://cloud.google.com/pubsub/docs/reference/libraries#client-libraries-install-python) if you run the example 2x it will generate the error:\r\n```\r\nGaxError(Exception occurred in retry method that was not classified as transient, caused by \u003c_Rendezvous of RPC that terminated with (StatusCode.ALREADY_EXISTS, Resource already exists in the project (resource=my-new-topic).)\u003e) \u003cclass 'google.gax.errors.RetryError'\u003e\r\n```\r\n\r\nHowever it should raise Conflict Error (google.cloud.exceptions.Conflict), because the API returns a 409 response.\r\nYou can see the status code using API Explorer:\r\nhttps://developers.google.com/apis-explorer/#search/pubsub/pubsub/v1/pubsub.projects.topics.create\r\n```\r\n409 \r\n{\r\n \"error\": {\r\n \"code\": 409,\r\n \"message\": \"Resource already exists in the project (resource=my-new-topic).\",\r\n \"status\": \"ALREADY_EXISTS\",\r\n...\r\n }\r\n}\r\n```\r\nFull traceback on Python:\r\n```\r\n\u003e\u003e\u003e topic.create()\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/usr/local/google/home/lucmult/.virtualenvs/pubsub/local/lib/python2.7/site-packages/google/cloud/pubsub/topic.py\", line 155, in create\r\n api.topic_create(topic_path=self.full_name)\r\n File \"/usr/local/google/home/lucmult/.virtualenvs/pubsub/local/lib/python2.7/site-packages/google/cloud/pubsub/_gax.py\", line 104, in topic_create\r\n topic_pb = self._gax_api.create_topic(topic_path)\r\n File \"/usr/local/google/home/lucmult/.virtualenvs/pubsub/local/lib/python2.7/site-packages/google/cloud/gapic/pubsub/v1/publisher_client.py\", line 278, in create_topic\r\n return self._create_topic(request, options)\r\n File \"/usr/local/google/home/lucmult/.virtualenvs/pubsub/local/lib/python2.7/site-packages/google/gax/api_callable.py\", line 419, in inner\r\n return api_caller(api_call, this_settings, request)\r\n File \"/usr/local/google/home/lucmult/.virtualenvs/pubsub/local/lib/python2.7/site-packages/google/gax/api_callable.py\", line 407, in base_caller\r\n return api_call(*args)\r\n File \"/usr/local/google/home/lucmult/.virtualenvs/pubsub/local/lib/python2.7/site-packages/google/gax/api_callable.py\", line 368, in inner\r\n return a_func(*args, **kwargs)\r\n File \"/usr/local/google/home/lucmult/.virtualenvs/pubsub/local/lib/python2.7/site-packages/google/gax/retry.py\", line 126, in inner\r\n ' classified as transient', exception)\r\ngoogle.gax.errors.RetryError: GaxError(Exception occurred in retry method that was not classified as transient, caused by \u003c_Rendezvous of RPC that terminated with (StatusCode.ALREADY_EXISTS, Resource already exists in the project (resource=my-new-topic).)\u003e)\r\n```\r\n \r\n","author":{"url":"https://github.com/lucmult","@type":"Person","name":"lucmult"},"datePublished":"2017-03-21T00:10:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/3175/google-cloud-python/issues/3175"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c1f93921-4606-5de7-9043-9910ce4e1028 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E5D2:6829B:41F65B:5A30E9:6A4DA12C |
| html-safe-nonce | 6f9f21fc2093a301715446db03bf0fef68a442bb009b57e5f4b2b7e233e34c5d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNUQyOjY4MjlCOjQxRjY1Qjo1QTMwRTk6NkE0REExMkMiLCJ2aXNpdG9yX2lkIjoiNTQ4ODc5NjY1NjQ4NzczNTU5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6762a77d4baea8d2908dfeb936a0398b5e727ce3ba9d0364a0ef221489813ac3 |
| hovercard-subject-tag | issue:215592621 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/3175/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ecc5aad3a9901f49c514e757e59c360c4522d678d9b646a216925915b3d48377/googleapis/google-cloud-python/issues/3175 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ecc5aad3a9901f49c514e757e59c360c4522d678d9b646a216925915b3d48377/googleapis/google-cloud-python/issues/3175 |
| og:image:alt | Following the documentation from PubSub site if you run the example 2x it will generate the error: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_Rend... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lucmult |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7f13faa65cccc9b729d674da83335d5dcfdfd193 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width