Add extra catch statements

This commit is contained in:
2022-03-16 13:37:18 +01:00
parent 4b41dc8321
commit d1f313bbf9
+23
View File
@@ -95,6 +95,14 @@ void MySQLClientImpl::Execute(const std::string& query)
if (errorCode == 2006 || errorCode == 2013)
InternalDisconnect();
}
catch (const std::exception& e)
{
std::stringstream ss;
ss << "MySQLClientImpl::Execute() - Error: " << e.what() << std::endl;
ss << "Query: " << query << std::endl;
Logging::Log(Logging::Severity::Error, ss.str());
InternalDisconnect();
}
}
std::shared_ptr<MySQLResultSetImpl> MySQLClientImpl::ExecuteQuery(const std::string& query)
@@ -127,6 +135,14 @@ std::shared_ptr<MySQLResultSetImpl> MySQLClientImpl::ExecuteQuery(const std::str
if (errorCode == 2006 || errorCode == 2013)
InternalDisconnect();
}
catch (const std::exception& e)
{
std::stringstream ss;
ss << "MySQLClientImpl::ExecuteQuery() - Error: " << e.what() << std::endl;
ss << "Query: " << query << std::endl;
Logging::Log(Logging::Severity::Error, ss.str());
InternalDisconnect();
}
return std::make_shared<MySQLResultSetImpl>(nullptr);
}
@@ -162,6 +178,13 @@ void MySQLClientImpl::InternalConnect()
Logging::Log(Logging::Severity::Error, ss.str());
InternalDisconnect();
}
catch (const std::exception& e)
{
std::stringstream ss;
ss << "MySQLClientImpl::Connect() - Error: " << e.what() << std::endl;
Logging::Log(Logging::Severity::Error, ss.str());
InternalDisconnect();
}
}
void MySQLClientImpl::InternalDisconnect()