summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-12 20:54:28 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-12 20:54:28 +0100
commitafd243cc87827c94f0cea73748ffc5c1fdf1880a (patch)
treead3f9c39902a78026b24d9a32e8baf6ff2858281 /test
parentCreate a basic MySQL testing database class (diff)
downloadmygrate-afd243cc87827c94f0cea73748ffc5c1fdf1880a.tar.bz2
mygrate-afd243cc87827c94f0cea73748ffc5c1fdf1880a.tar.xz
mygrate-afd243cc87827c94f0cea73748ffc5c1fdf1880a.zip
Avoid direct use of runtime_error in PostgreSQL stuff
Adds proper exception which extends it and gets the PostgreSQL error message.
Diffstat (limited to 'test')
-rw-r--r--test/test-postgresql.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test-postgresql.cpp b/test/test-postgresql.cpp
index 3a12f43..eaf6d58 100644
--- a/test/test-postgresql.cpp
+++ b/test/test-postgresql.cpp
@@ -22,11 +22,11 @@ BOOST_AUTO_TEST_CASE(simple)
BOOST_CHECK_THROW(([]() {
MyGrate::Output::Pq::PqConn {"nonsense"};
}()),
- std::runtime_error);
+ MyGrate::Output::Pq::PqErr);
MyGrate::Output::Pq::PqConn c {CONNSTR};
BOOST_CHECK_NO_THROW(c.query("SET application_name = ''"));
BOOST_CHECK_NO_THROW(c.query("SET application_name = 'something'"));
- BOOST_CHECK_THROW(c.query("SET application_name = "), std::runtime_error);
+ BOOST_CHECK_THROW(c.query("SET application_name = "), MyGrate::Output::Pq::PqErr);
// BOOST_CHECK_THROW(c.query("SET application_name = $1", {}), std::logic_error);
BOOST_CHECK_NO_THROW(c.query("SET application_name = 'something'", {}));
c.query("DROP TABLE IF EXISTS test");
@@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(simple)
BOOST_CHECK_NO_THROW(c.query("INSERT INTO test VALUES($1)", {"string_view"}));
BOOST_CHECK_NO_THROW(c.query("INSERT INTO test VALUES($1)", {nullptr}));
BOOST_CHECK_NO_THROW(c.query("INSERT INTO test VALUES($1)", {1.2}));
- BOOST_CHECK_THROW(c.query("INSERT INTO test VALUES($1)", {MyGrate::Time {}}), std::runtime_error);
+ BOOST_CHECK_THROW(c.query("INSERT INTO test VALUES($1)", {MyGrate::Time {}}), std::logic_error);
c.query("DROP TABLE test");
}