Skip to content

Commit

Permalink
feat(firestore): surfacing the error returned from the service in Bul…
Browse files Browse the repository at this point in the history
…kwriter (#10826)
  • Loading branch information
bhshkh authored Sep 19, 2024
1 parent cf67711 commit 9ae039a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions firestore/bulkwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (bw *BulkWriter) Create(doc *DocumentRef, datum interface{}) (*BulkWriterJo

w, err := doc.newCreateWrites(datum)
if err != nil {
return nil, fmt.Errorf("firestore: cannot create %v with %v", doc.ID, datum)
return nil, fmt.Errorf("firestore: cannot create %v with %v. %w", doc.ID, datum, err)
}

if len(w) > 1 {
Expand All @@ -201,7 +201,7 @@ func (bw *BulkWriter) Delete(doc *DocumentRef, preconds ...Precondition) (*BulkW

w, err := doc.newDeleteWrites(preconds)
if err != nil {
return nil, fmt.Errorf("firestore: cannot delete doc %v", doc.ID)
return nil, fmt.Errorf("firestore: cannot delete doc %v. %w", doc.ID, err)
}

if len(w) > 1 {
Expand All @@ -224,7 +224,7 @@ func (bw *BulkWriter) Set(doc *DocumentRef, datum interface{}, opts ...SetOption

w, err := doc.newSetWrites(datum, opts)
if err != nil {
return nil, fmt.Errorf("firestore: cannot set %v on doc %v", datum, doc.ID)
return nil, fmt.Errorf("firestore: cannot set %v on doc %v. %w", datum, doc.ID, err)
}

if len(w) > 1 {
Expand All @@ -247,7 +247,7 @@ func (bw *BulkWriter) Update(doc *DocumentRef, updates []Update, preconds ...Pre

w, err := doc.newUpdatePathWrites(updates, preconds)
if err != nil {
return nil, fmt.Errorf("firestore: cannot update doc %v", doc.ID)
return nil, fmt.Errorf("firestore: cannot update doc %v. %w", doc.ID, err)
}

if len(w) > 1 {
Expand Down

0 comments on commit 9ae039a

Please sign in to comment.