summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-12 20:26:01 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-12 20:26:01 +0100
commit231bc3fc8d1902bb19b6fce39ffd72cce4b4f2c3 (patch)
treee074ea9bf53400600831215822a848fe27bfac55 /test
parentHave verify return its expression, might be useful (diff)
downloadmygrate-231bc3fc8d1902bb19b6fce39ffd72cce4b4f2c3.tar.bz2
mygrate-231bc3fc8d1902bb19b6fce39ffd72cce4b4f2c3.tar.xz
mygrate-231bc3fc8d1902bb19b6fce39ffd72cce4b4f2c3.zip
Avoid direct use of runtime_error in MySQL stuff
Adds proper exception which extends it and gets the MySQL error message.
Diffstat (limited to 'test')
-rw-r--r--test/test-mysql.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test-mysql.cpp b/test/test-mysql.cpp
index de9dd83..d91f54e 100644
--- a/test/test-mysql.cpp
+++ b/test/test-mysql.cpp
@@ -26,18 +26,18 @@ BOOST_AUTO_TEST_CASE(simple)
BOOST_CHECK_THROW(([]() {
MyGrate::Input::MySQLConn {SERVER, USER, "badpass", PORT};
}()),
- std::runtime_error);
+ MyGrate::Input::MySQLErr);
MyGrate::Input::MySQLConn c {SERVER, USER, PASSWORD, PORT};
BOOST_CHECK_NO_THROW(c.query("SET @var = ''"));
BOOST_CHECK_NO_THROW(c.query("SET @var = 'something'"));
- BOOST_CHECK_THROW(c.query("SET @var = "), std::runtime_error);
+ BOOST_CHECK_THROW(c.query("SET @var = "), MyGrate::Input::MySQLErr);
BOOST_CHECK_THROW(c.query("SET @var = ?", {}), std::logic_error);
BOOST_CHECK_NO_THROW(c.query("SET @var = ''", {}));
BOOST_CHECK_NO_THROW(c.query("SET @var = ?", {1}));
BOOST_CHECK_NO_THROW(c.query("SET @var = ?", {"string_view"}));
BOOST_CHECK_NO_THROW(c.query("SET @var = ?", {nullptr}));
BOOST_CHECK_NO_THROW(c.query("SET @var = ?", {1.2}));
- BOOST_CHECK_THROW(c.query("SET @var = ?", {MyGrate::Time {}}), std::runtime_error);
+ BOOST_CHECK_THROW(c.query("SET @var = ?", {MyGrate::Time {}}), std::logic_error);
}
using SomeSelect = MyGrate::DbStmt<"SELECT * FROM foo">;