Skip to content

Fix wrong get_check_exists sample. No exception handling is required anymore #2429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions firestore/cloud-client/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from time import sleep

from google.cloud import firestore
import google.cloud.exceptions


def quickstart_new_instance():
Expand Down Expand Up @@ -217,10 +216,10 @@ def get_check_exists():
# [START get_check_exists]
doc_ref = db.collection(u'cities').document(u'SF')

try:
doc = doc_ref.get()
doc = doc_ref.get()
if doc.exists:
print(u'Document data: {}'.format(doc.to_dict()))
except google.cloud.exceptions.NotFound:
else:
print(u'No such document!')
# [END get_check_exists]

Expand Down