Mongo Client Exception Format in mongo 3.6 is showing different than in mongo 4.0

Format of Exception in mongo 3.6.9 server with 3.7.1 mongo java driver is showing as :

Exception in updating status1 -3 msg Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=2001:db8:1168:2000:0:0:0:205:27041, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName=‘backupuser’, source=‘admin’, password=, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: ‘Authentication failed.’ on server 2001:db8:1168:2000:0:0:0:205:27041. The full response is { “ok” : 0.0, “errmsg” : “Authentication failed.”, “code” : 18, “codeName” : “AuthenticationFailed” }}}]

But in same scenerio format of Exception in mongo 4.0.27 server with 3.12.0 mongo java driver is showing as :

Exception in updating status1 -4 msg Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName=‘backupuser’, source=‘admin’, password=, mechanismProperties=}

Additional Info:

  • This exception I m testing when there is no user present on replica non-arbiter member and we are trying to connect that replica member with username and password.

  • In above output -3 and -4 represents Exception.getCode()

Please resolve the below queries:

  • In mongo 4.0, it is showing less content and also it is not showing any parent exception detail like in mongo 3.6 (com.mongodb.MongoCommandException).

  • What is difference between -3 and -4 in above cases.

Kindly reply to this.