diff --git a/src/clojure/monger/core.clj b/src/clojure/monger/core.clj index 5573bc6..fe24ec1 100644 --- a/src/clojure/monger/core.clj +++ b/src/clojure/monger/core.clj @@ -236,8 +236,8 @@ (let [uri (MongoClientURI. uri-string) conn (MongoClient. uri) dbName (.getDatabase uri)] - (if (nil? dbName) - (throw (Exception. "No database name specified in uri")) + (if (not dbName) + (throw (IllegalArgumentException. "No database name specified in uri")) (let [db (.getDB conn dbName)] {:conn conn :db db})))) diff --git a/test/monger/test/core_test.clj b/test/monger/test/core_test.clj index c8082ce..02f45dc 100644 --- a/test/monger/test/core_test.clj +++ b/test/monger/test/core_test.clj @@ -73,4 +73,4 @@ (deftest connect-to-uri-without-db-name (let [uri "mongodb://localhost:27017"] - (is (thrown? Exception (mg/connect-via-uri uri))))) + (is (thrown? IllegalArgumentException (mg/connect-via-uri uri)))))