... since it's all just a test - added a try catch on db connection
This commit is contained in:
parent
03f38387e2
commit
89b80f0656
@ -14,7 +14,13 @@ Server::Server():
|
|||||||
|
|
||||||
db->setCredentials("pica", "pica");
|
db->setCredentials("pica", "pica");
|
||||||
db->setDatabase("pica");
|
db->setDatabase("pica");
|
||||||
|
|
||||||
|
try {
|
||||||
db->connect("/run/mysqld/mysqld.sock");
|
db->connect("/run/mysqld/mysqld.sock");
|
||||||
|
std::cout << "Successfully connected to the database" << std::endl;
|
||||||
|
} catch (const std::runtime_error& e) {
|
||||||
|
std::cerr << "Couldn't connect to the database: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
router.addRoute("info", Server::info);
|
router.addRoute("info", Server::info);
|
||||||
router.addRoute("env", Server::printEnvironment);
|
router.addRoute("env", Server::printEnvironment);
|
||||||
|
Loading…
Reference in New Issue
Block a user