[glom/glom-1-16] Catch Gnome::Gda::ConfigError exceptions.



commit 5bb710d572794f075dce364313cc007503ff8061
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Aug 31 15:24:46 2010 +0200

    Catch Gnome::Gda::ConfigError exceptions.
    
    	* glom/libglom/connectionpool_backends/postgres.cc:
    	* glom/libglom/connectionpool_backends/sqlite.cc: Output to stderr when
      we get ConfigError exceptions. This is informative when the tests fail
      because of missing libgda providers. Note that this won't happen in the UI
      because we test for the providers at startup.

 ChangeLog                                        |   10 ++++++++++
 glom/libglom/connectionpool_backends/postgres.cc |   18 ++++++++++++++++++
 glom/libglom/connectionpool_backends/sqlite.cc   |   18 ++++++++++++++++++
 3 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0138323..82a2a17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-31  Murray Cumming  <murrayc murrayc com>
+
+	Catch Gnome::Gda::ConfigError exceptions.
+
+	* glom/libglom/connectionpool_backends/postgres.cc:
+	* glom/libglom/connectionpool_backends/sqlite.cc: Output to stderr when
+  we get ConfigError exceptions. This is informative when the tests fail
+  because of missing libgda providers. Note that this won't happen in the UI
+  because we test for the providers at startup.
+
 2010-08-10  Murray Cumming  <murrayc murrayc com>
 
 	Catch exceptions from std::locale::global().
diff --git a/glom/libglom/connectionpool_backends/postgres.cc b/glom/libglom/connectionpool_backends/postgres.cc
index 3b54714..a3de73b 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -91,6 +91,15 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
     connection->statement_execute_non_select("SET DATESTYLE = 'ISO'");
     data_model = connection->statement_execute_select("SELECT version()");
   }
+  catch(const Gnome::Gda::ConfigError& ex)
+  {
+    //These errors are unusual.
+    //For instance, the PostgreSQL libgda provider could be missing,
+    //though we check for that at startup.
+    std::cerr << G_STRFUNC << 
+      ": ConfigError exception from Gnome::Gda::Connection::open_from_string(): " <<
+      ex.what();
+  }
   catch(const Glib::Error& ex)
   {
 #else
@@ -125,6 +134,15 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
         cnc_string, auth_string,
         Gnome::Gda::CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
     }
+    catch(const Gnome::Gda::ConfigError& ex)
+    {
+      //These errors are unusual.
+      //For instance, the PostgreSQL libgda provider could be missing,
+      //though we check for that at startup.
+      std::cerr << G_STRFUNC << 
+        ": ConfigError exception from Gnome::Gda::Connection::open_from_string(): " <<
+        ex.what();
+    }
     catch(const Glib::Error& ex)
     {}
 #else
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index a7bb785..fe10e90 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -62,6 +62,15 @@ Glib::RefPtr<Gnome::Gda::Connection> Sqlite::connect(const Glib::ustring& databa
         cnc_string, auth_string,
         Gnome::Gda::CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
     }
+    catch(const Gnome::Gda::ConfigError& ex)
+    {
+      //These errors are unusual.
+      //For instance, the SQLite libgda provider could be missing,
+      //though we check for that at startup.
+      std::cerr << G_STRFUNC << 
+        ": ConfigError exception from Gnome::Gda::Connection::open_from_string(): " <<
+        ex.what();
+    }
     catch(const Glib::Error& ex)
     {
 #else
@@ -106,6 +115,15 @@ bool Sqlite::create_database(const Glib::ustring& database_name, const Glib::ust
         cnc_string, "",
         Gnome::Gda::CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
   }
+  catch(const Gnome::Gda::ConfigError& ex)
+  {
+    //These errors are unusual.
+    //For instance, the PostgreSQL libgda provider could be missing,
+    //though we check for that at startup.
+    std::cerr << G_STRFUNC << 
+      ": ConfigError exception from Gnome::Gda::Connection::open_from_string(): " <<
+      ex.what();
+  }
   catch(const Glib::Error& ex)
   {
     error.reset(new Glib::Error(ex));



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