From 231bc3fc8d1902bb19b6fce39ffd72cce4b4f2c3 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 12 Jun 2021 20:26:01 +0100 Subject: Avoid direct use of runtime_error in MySQL stuff Adds proper exception which extends it and gets the MySQL error message. --- test/test-mysql.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') 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">; -- cgit v1.2.3