summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/pracrodaopgsql.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc
index c1ec9b1..d1ba517 100644
--- a/server/src/pracrodaopgsql.cc
+++ b/server/src/pracrodaopgsql.cc
@@ -54,7 +54,13 @@ PracroDAOPgsql::PracroDAOPgsql(std::string _host, std::string _port, std::string
if(user.size()) cs += " user=" + user;
if(passwd.size()) cs += " password=" + passwd;
cs += " dbname=" + (dbname.size() ? dbname : "pracro");
- conn = new pqxx::connection(cs);
+ try {
+ conn = new pqxx::connection(cs);
+ } catch(std::exception &e) {
+ PRACRO_ERR_LOG(db, "Postgresql init failed: %s\n", e.what());
+ conn = NULL;
+ }
+
PRACRO_DEBUG(db, "Pgsql connection %p (%s)\n", conn, cs.c_str());
}