diff options
author | deva <deva> | 2009-08-07 12:59:53 +0000 |
---|---|---|
committer | deva <deva> | 2009-08-07 12:59:53 +0000 |
commit | 83722ef5a1c46ee3e9a15d9c16daf227f06e56cb (patch) | |
tree | f43f594469d1f5919db3f6b203f801071352838c /server/src/pracrodaopgsql.cc | |
parent | 06b6dd5af421170343120cb5855fcd6075148789 (diff) |
Catch exceptions from new connection.
Diffstat (limited to 'server/src/pracrodaopgsql.cc')
-rw-r--r-- | server/src/pracrodaopgsql.cc | 8 |
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()); } |