-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Error Handling, Sessions, Transactions
-
Go Drivers
Detailed steps to reproduce the problem?
Related closed issue: https://jira.mongodb.org/browse/GODRIVER-1962
Wrap two or more errors by fmt.Errorf("%w, %w") or errors.Join(err1, errFromMongoDriver).
This method will not be able to detect the error from the driver correctly and will make transactions not be retried in my case because the unwrap method is used here.
package main import ( "errors" "fmt" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/mongo/driver" ) func main() { err := errors.New("customized error") labeledErr := mongo.CommandError{Labels: []string{driver.NetworkError}} multiWrappedErr := errors.Join(err, labeledErr) res := mongo.IsNetworkError(multiWrappedErr) fmt.Println(res) // Prints "false", expected to be "true" }
Definition of done: what must be done to consider the task complete?
Add Unwrap() []error assertion handle in this method.
The exact Go version used, with patch level:
$ go version
go version go1.22.1 linux/amd64
The exact version of the Go driver used:
$ go list -m go.mongodb.org/mongo-driver
go.mongodb.org/mongo-driver v1.16.1
Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.
I set up the MongoDB in docker using the cluster mode with a single node.
The operating system and version (e.g. Windows 7, OSX 10.8, ...)
Windows WSL Ubuntu
Security Vulnerabilities
If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here