diff --git a/mongodb.module b/mongodb.module
index abdbfaa..6e5bd22 100644
--- a/mongodb.module
+++ b/mongodb.module
@@ -30,9 +30,17 @@ function mongodb($alias = 'default') {
   $options = $connection['connection_options'] +  array('connect' => TRUE);
   $db = $connection['db'];
   if (!isset($mongo_objects[$host][$db])) {
-    $mongo = new Mongo($host, $options);
-    $mongo_objects[$host][$db] = $mongo->selectDB($db);
-    $mongo_objects[$host][$db]->connection = $mongo;
+    try {
+      $mongo = new Mongo($host, $options);
+      $mongo_objects[$host][$db] = $mongo->selectDB($db);
+      $mongo_objects[$host][$db]->connection = $mongo;
+    }
+    catch (Exception $e) {
+      // We failed the instentiate the Mongo object - log and error and return FALSE
+      $mongo_objects[$host][$db] = FALSE;
+      watchdog('mongodb',$e->getMessage(), NULL, WATCHDOG_ERROR);
+      return FALSE;
+    }
   }
   return $mongo_objects[$host][$db];
 }
@@ -57,6 +65,9 @@ function mongodb_collection() {
   // non-prefixed version so it's enough to prefix after choosing the mongodb
   // object.
   $mongodb_object = mongodb($alias);
+  if (!$mongodb_object) {
+    return FALSE;
+  }
   $collection = $mongodb_object->selectCollection(mongodb_collection_name($collection_name));
   $collection->connection = $mongodb_object->connection;
   return variable_get('mongodb_debug', FALSE) ? new mongoDebugCollection($collection) : $collection;
diff --git a/mongodb_watchdog/mongodb_watchdog.module b/mongodb_watchdog/mongodb_watchdog.module
index 6cd1f3d..ea45aa3 100644
--- a/mongodb_watchdog/mongodb_watchdog.module
+++ b/mongodb_watchdog/mongodb_watchdog.module
@@ -109,7 +109,13 @@ function mongodb_watchdog_watchdog(array $log_entry) {
     '$set' => $log_entry,
     '$inc' => array('count' => 1),
   );
+  
   $collection = mongodb_collection(variable_get('mongodb_watchdog', 'watchdog'));
+  if (!$collection) {
+    drupal_set_message('Error: Unable to connect to MongoDB collection to log watchdog message','error');
+    return;
+  }
+
   $id = md5($log_entry['function'] . ':' . $log_entry['line'] . ':' . $log_entry['severity'] . ':' . $log_entry['type'] . ':' . $log_entry['message']);
   $collection->update(array('_id' => $id), $newobj, array('upsert' => TRUE));
   $result = $collection->db->command(array('getlasterror' => 1));
