Skip to content

Commit 3e9884e

Browse files
committed
correct the err message
1 parent 29456f0 commit 3e9884e

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

firestore/pipeline_integration_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,6 @@ func aggregationFuncs(t *testing.T) {
931931
docRefs = append(docRefs, docRef)
932932
h.mustCreate(docRef, d)
933933
}
934-
t.Cleanup(func() {
935-
deleteDocuments(docRefs)
936-
})
937934

938935
pipeline := client.Pipeline().Collection(coll.ID).
939936
Sort(Orders(Ascending(FieldOf("val")))).

firestore/pipeline_source.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
package firestore
1616

17+
import "fmt"
18+
1719
// PipelineSource is a factory for creating Pipeline instances.
1820
// It is obtained by calling [Client.Pipeline].
1921
//
@@ -168,7 +170,14 @@ func (ps *PipelineSource) Documents(refs []*DocumentRef, opts ...DocumentsOption
168170
opt.applyStage(options)
169171
}
170172
}
171-
return newPipeline(ps.client, newInputStageDocuments(refs, options))
173+
p := newPipeline(ps.client, newInputStageDocuments(refs, options))
174+
for _, ref := range refs {
175+
if ref == nil {
176+
p.err = fmt.Errorf("firestore: Documents() cannot contain nil references")
177+
break
178+
}
179+
}
180+
return p
172181
}
173182

174183
// CreateFromQuery creates a new [Pipeline] from the given [Queryer]. Under the hood, this will

firestore/pipeline_stage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (s *inputStageDocuments) toProto() (*pb.Pipeline_Stage, error) {
158158
args := make([]*pb.Value, len(s.refs))
159159
for i, ref := range s.refs {
160160
if ref == nil {
161-
return nil, fmt.Errorf("firestore: internal error: inputStageDocuments contains nil reference")
161+
return nil, fmt.Errorf("firestore: inputStageDocuments contains nil reference")
162162
}
163163
args[i] = &pb.Value{ValueType: &pb.Value_ReferenceValue{ReferenceValue: "/" + ref.shortPath}}
164164
}

0 commit comments

Comments
 (0)