diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-12 20:26:01 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-12 20:26:01 +0100 |
commit | 231bc3fc8d1902bb19b6fce39ffd72cce4b4f2c3 (patch) | |
tree | e074ea9bf53400600831215822a848fe27bfac55 /test | |
parent | Have verify return its expression, might be useful (diff) | |
download | mygrate-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.cpp | 6 |
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">; |