Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-378

Unconnected Client should return a mongo level error, not topology level error

      Currently when a user attempts to use a newly instantiated Client, they currently receive topology.ErrTopologyClosed error. This is confusing for users of the high level API since they don't have in-depth knowledge of a topology. We can solve this in one of two ways:

      1. Check for ErrTopologyClosed and transform it into a ErrClientDisconnected error
      2. Add a connection state to Client and check if the Client is connected before performing an operation.

      While the second option provides a faster path to failure and is less invasive, it introduces a race condition, where users that call Disconnect might still see a topology.ErrTopologyClosed error. Eventually, we'll need to wrap most of the core API packages' errors, so starting with ErrTopologyClosed seems like a sensible thing to do.

      A general error handling function can be created in the mongo package or attached to the *mongo.Collection type to handle the transformation.

            Assignee:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Reporter:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: