[CDRIVER-2616] Improve connection error messages Created: 17/Apr/18  Updated: 19/Apr/18  Resolved: 19/Apr/18

Status: Closed
Project: C Driver
Component/s: errors, libmongoc, tls
Affects Version/s: 1.5.0
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Jixing Li [X] Assignee: A. Jesse Jiryu Davis
Resolution: Duplicate Votes: 0
Labels: driver, feature
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Currently, many connections errors return "error: Error from MongoDB Client: No suitable servers found (`serverSelectionTryOnce` set). It doesn't specify what is the exact problem is.

For example, we want to connect to a mongo atlas server with SSL enabled.
1) We don't have any IP address in the whitelist or
2) we don't provide the path to the CA file.

For the above two cases, the error message coming from mongoc_topology_select_server_id API call returned is very generic. Is it possible to provide some detail message like "client cannot connect to the server" and"CA file is empty" respectively.



 Comments   
Comment by A. Jesse Jiryu Davis [ 19/Apr/18 ]

Hi, the latest driver does provide good feedback, I recommend you upgrade. For example:

./example-client mongodb://foo
Cursor Failure: No suitable servers found (`serverSelectionTryOnce` set): [Failed to resolve 'foo']
./example-client 'mongodb://localhost/?ssl=true'
Cursor Failure: No suitable servers found (`serverSelectionTryOnce` set): [TLS handshake failed: connection closed via error (-9806) calling ismaster on 'localhost:27017']

Generated at Wed Feb 07 21:15:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.