June 2017
Intermediate to advanced
536 pages
9h 49m
English
Handling errors is pretty straightforward with the try...catch blocks, as MongoDBDriverExceptionException is being thrown whenever an error occurs:
<?phprequire_once __DIR__ . '/vendor/autoload.php';try { $manager = new MongoDBDriverManager('mongodb://localhost:27017');} catch (MongoDBDriverExceptionException $e) { echo $e->getMessage(), PHP_EOL; exit;}