Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

No more connection exception message when MongoDB is unavailable

  • Loading branch information...
commit ae544a36b229bb639dc985e7b37ea1ce851a4eee 1 parent 450eb31
Marc Qualie authored

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. +10 2 server/lib/mongox.php
12 server/lib/mongox.php
@@ -24,8 +24,16 @@ public static function init ($uri, array $opt = array())
24 24 public static function connect ()
25 25 {
26 26 self::$connected = true;
27   - self::$conn = new Mongo(self::$uri);
28   - self::$db = self::$conn->selectDb(self::$db_name);
  27 + try
  28 + {
  29 + self::$conn = new Mongo(self::$uri);
  30 + self::$db = self::$conn->selectDb(self::$db_name);
  31 + }
  32 + catch (Exception $e)
  33 + {
  34 + echo 'There was a problem connecting to MongoDB';
  35 + exit;
  36 + }
29 37 }
30 38
31 39 public static function selectDb ($db_name)

0 comments on commit ae544a3

Please sign in to comment.
Something went wrong with that request. Please try again.