@@ -248,7 +248,7 @@ func (coll *Collection) BulkWrite(ctx context.Context, models []WriteModel,
248
248
249
249
err = op .execute (ctx )
250
250
251
- return & op .result , replaceErrors (err )
251
+ return & op .result , wrapErrors (err )
252
252
}
253
253
254
254
func (coll * Collection ) insert (
@@ -1049,15 +1049,15 @@ func aggregate(a aggregateParams, opts ...options.Lister[options.AggregateOption
1049
1049
if errors .As (err , & wce ) && wce .WriteConcernError != nil {
1050
1050
return nil , * convertDriverWriteConcernError (wce .WriteConcernError )
1051
1051
}
1052
- return nil , replaceErrors (err )
1052
+ return nil , wrapErrors (err )
1053
1053
}
1054
1054
1055
1055
bc , err := op .Result (cursorOpts )
1056
1056
if err != nil {
1057
- return nil , replaceErrors (err )
1057
+ return nil , wrapErrors (err )
1058
1058
}
1059
1059
cursor , err := newCursorWithSession (bc , a .client .bsonOpts , a .registry , sess )
1060
- return cursor , replaceErrors (err )
1060
+ return cursor , wrapErrors (err )
1061
1061
}
1062
1062
1063
1063
// CountDocuments returns the number of documents in the collection. For a fast count of the documents in the
@@ -1132,7 +1132,7 @@ func (coll *Collection) CountDocuments(ctx context.Context, filter interface{},
1132
1132
1133
1133
err = op .Execute (ctx )
1134
1134
if err != nil {
1135
- return 0 , replaceErrors (err )
1135
+ return 0 , wrapErrors (err )
1136
1136
}
1137
1137
1138
1138
batch := op .ResultCursorResponse ().FirstBatch
@@ -1213,7 +1213,7 @@ func (coll *Collection) EstimatedDocumentCount(
1213
1213
op .Retry (retry )
1214
1214
1215
1215
err = op .Execute (ctx )
1216
- return op .Result ().N , replaceErrors (err )
1216
+ return op .Result ().N , wrapErrors (err )
1217
1217
}
1218
1218
1219
1219
// Distinct executes a distinct command to find the unique values for a specified field in the collection.
@@ -1302,7 +1302,7 @@ func (coll *Collection) Distinct(
1302
1302
1303
1303
err = op .Execute (ctx )
1304
1304
if err != nil {
1305
- return & DistinctResult {err : replaceErrors (err )}
1305
+ return & DistinctResult {err : wrapErrors (err )}
1306
1306
}
1307
1307
1308
1308
arr , ok := op .Result ().Values .ArrayOK ()
@@ -1504,12 +1504,12 @@ func (coll *Collection) find(
1504
1504
op = op .Retry (retry )
1505
1505
1506
1506
if err = op .Execute (ctx ); err != nil {
1507
- return nil , replaceErrors (err )
1507
+ return nil , wrapErrors (err )
1508
1508
}
1509
1509
1510
1510
bc , err := op .Result (cursorOpts )
1511
1511
if err != nil {
1512
- return nil , replaceErrors (err )
1512
+ return nil , wrapErrors (err )
1513
1513
}
1514
1514
return newCursorWithSession (bc , coll .bsonOpts , coll .registry , sess )
1515
1515
}
@@ -1560,7 +1560,7 @@ func (coll *Collection) FindOne(ctx context.Context, filter interface{},
1560
1560
cur : cursor ,
1561
1561
bsonOpts : coll .bsonOpts ,
1562
1562
reg : coll .registry ,
1563
- err : replaceErrors (err ),
1563
+ err : wrapErrors (err ),
1564
1564
}
1565
1565
}
1566
1566
@@ -2044,7 +2044,7 @@ func (coll *Collection) drop(ctx context.Context) error {
2044
2044
// ignore namespace not found errors
2045
2045
var driverErr driver.Error
2046
2046
if ! errors .As (err , & driverErr ) || ! driverErr .NamespaceNotFound () {
2047
- return replaceErrors (err )
2047
+ return wrapErrors (err )
2048
2048
}
2049
2049
return nil
2050
2050
}
0 commit comments