[glom] Test: Catch an exception.



commit d98cf950f63045543ebb934d1ce2e48636369ddc
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Oct 10 14:27:28 2011 +0200

    Test: Catch an exception.

 glom/libglom/test_connectionpool.cc |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/glom/libglom/test_connectionpool.cc b/glom/libglom/test_connectionpool.cc
index 549f3dc..f62ad21 100644
--- a/glom/libglom/test_connectionpool.cc
+++ b/glom/libglom/test_connectionpool.cc
@@ -64,8 +64,16 @@ int main()
 
     //Connect:
     Glom::sharedptr<Glom::SharedConnection> connection;
-    connection = Glom::ConnectionPool::get_and_connect();
-
+    
+    try
+    {
+      connection = Glom::ConnectionPool::get_and_connect();
+    }
+    catch(const Glom::ExceptionConnection& ex)
+    {
+      std::cout << "Exception: " << ex.what() << std::endl;
+    }
+    
     if(connection)
       std::cout << "Connected" << std::endl;
     else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]