docs(firestore): document terminal error behavior for iterators#14456
Merged
bhshkh merged 1 commit intogoogleapis:mainfrom Apr 20, 2026
Merged
docs(firestore): document terminal error behavior for iterators#14456bhshkh merged 1 commit intogoogleapis:mainfrom
bhshkh merged 1 commit intogoogleapis:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for several iterator types in the Firestore package to clarify that terminal errors are cached and returned on subsequent calls to Next(). While this behavior is implemented in some iterators like DocumentIterator, the review feedback correctly identifies that CollectionIterator, DocumentSnapshotIterator, and DocumentRefIterator lack the necessary error-caching logic to support these documentation claims, leading to an inconsistency between the code and its description.
This was referenced Apr 20, 2026
shollyman
approved these changes
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update the documentation for handwritten iterators to explicitly state that they return the same error indefinitely after an error occurs.
This allows:
storageexplicitly documents it). Keeping this behavior in Firestore maintains consistency across the google-cloud-go repository. Changing it only in Firestore would create a special case.iterator.Doneon the second call, we risk masking the error. If a user ignores the error on the first call and callsNext()again, they will getiterator.Doneand might assume the iteration completed successfully, processing a partial list of results without realizing an error occurred.Fixes: #12694
Fixes: #13359