-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
PYTHON-1577 introduced the ability for a user to provide a server_selector function that augments the server selection process in an arbitrary, user-defined way. Currently, the error message we display with a SeverSelectionTimeoutError does not mention that server selection could have failed due to an improperly defined selector function. We should make this error message 'smarter' to hint to the user that the server_selector could be a source of possible error when selection times out and a custom selector is being used by the client.
Here is what a SeverSelectionTimeoutError with a faulty server_selector currently looks like:
In[2]: from pymongo import MongoClient In[3]: def selector(selectors): ...: return [] In[4]: mc = MongoClient(replicaSet='replSet', server_selector=selector) In[5]: mc.db.coll.insert_one({'a': 1}) Traceback (most recent call last): ... pymongo.errors.ServerSelectionTimeoutError: No primary available for writes
- related to
-
PYTHON-2136 Provide diagnostic information in ServerSelectionTimeoutError exception message
- Closed