diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 02:42:43 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 06:00:07 +0000 |
commit | da82e9c8f09f3e471044f8b52ede478ac4d5bc04 (patch) | |
tree | eb8c79922a088398ad2e155dec0d6e831a1378ba /libpqpp/pq-error.cpp | |
parent | Remove rebind (diff) | |
download | libdbpp-postgresql-da82e9c8f09f3e471044f8b52ede478ac4d5bc04.tar.bz2 libdbpp-postgresql-da82e9c8f09f3e471044f8b52ede478ac4d5bc04.tar.xz libdbpp-postgresql-da82e9c8f09f3e471044f8b52ede478ac4d5bc04.zip |
Reshuffle and add new exceptions
Diffstat (limited to 'libpqpp/pq-error.cpp')
-rw-r--r-- | libpqpp/pq-error.cpp | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/libpqpp/pq-error.cpp b/libpqpp/pq-error.cpp index 0d0299c..3a16185 100644 --- a/libpqpp/pq-error.cpp +++ b/libpqpp/pq-error.cpp @@ -1,34 +1,14 @@ #include "pq-error.h" #include <string.h> -PQ::Error::Error() : - msg(NULL) +PQ::Error::Error(const PGconn * conn) : + msg(PQerrorMessage(conn)) { } -PQ::Error::Error(const PQ::Error & e) : - msg(e.msg ? strdup(e.msg) : NULL) -{ -} - -PQ::Error::Error(const char * e) : - msg(e ? strdup(e) : NULL) -{ -} - -PQ::Error::~Error() throw() -{ - free(msg); -} - -const char * -PQ::Error::what() const throw() -{ - return msg ? msg : "No message"; -} - -PQ::ConnectionError::ConnectionError(const PGconn * conn) : - PQ::Error(PQerrorMessage(conn)) +std::string +PQ::Error::message() const throw() { + return msg; } |