Skip to content

Commit

Permalink
chore(firestore): Clarify Transactioln.Get error code (#6121)
Browse files Browse the repository at this point in the history
Clarifies that `Transaction.Get()` returns an error with `NotFound` status code.

Co-authored-by: Hidehito Yabuuchi <ordovicia@users.noreply.github.com>
Co-authored-by: Eno Compton <enocom@google.com>
  • Loading branch information
3 people committed Aug 5, 2022
1 parent 076c35b commit 0fe3506
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion firestore/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ func (t *Transaction) rollback() {
}

// Get gets the document in the context of the transaction. The transaction holds a
// pessimistic lock on the returned document.
// pessimistic lock on the returned document. If the document does not exist, Get
// returns a NotFound error, which can be checked with
// status.Code(err) == codes.NotFound
func (t *Transaction) Get(dr *DocumentRef) (*DocumentSnapshot, error) {
docsnaps, err := t.GetAll([]*DocumentRef{dr})
if err != nil {
Expand Down

0 comments on commit 0fe3506

Please sign in to comment.