The connection to the cluster does not throw exceptions when the credentials are wrong

Good morning,
I’m using Couchbase sdk net client 3.1.3 and couchbase server 6.6.0 and I have a connection problem with the cluster.
Case 1:
I try to connect to the cluster synchronously passing voluntarily IP address, username or password wrong.
In this case no exception is thrown. Instead I would have expected it.
I take the parameters for the connection from a front end mask and then if the user writes them wrong I would like the code to throw an exception

Task<ICluster> cluster = null;
                ClusterOptions options = new ClusterOptions()
                    UserName = pConfig.user,
                    Password = pConfig.password,
                    ConnectionString = pConfig.server

                cluster = Cluster.ConnectAsync(options);
            catch (Exception e)
                return null;

Case 2:
In asynchronous mode, the “WaitUntilReadyAsync method (TimeSpan.FromSeconds (10))” throws an exception :

Cluster level WaitUntilReady is only supported by Couchbase Server 6.5 or greater. If you think this exception is caused by another error, please check your SDK logs for detail.

What is the correct way to throw the correct exception when connections parameters are wrong?

While we don’t suggest synchronously connecting in that manner, there is a legit bug here.

There are two different cases:

  • If the hostname is invalid, the client will continue to attempt to bootstrap until it times out. It does this because it doesn’t know why the connection cannot be made and its possible it may be a temporary glitch.

  • If the credentials (user/password) are invalid a AuthenticationFailureException should bubble up, but because of the bug above, it gets suppressed and logged - so its not happening.

This should be fixed in a future version of the SDK.