如何在mongoDB和PHP连接问题时抛出错误?

In php and mysql we use mysqli_error(connection); to show error but how to show error while php mongoDB connection goes wrong. $m = new MongoClient(); please help..!

Use the MongoConnectionException class..

This exception gets thrown when you have connection issues.