diff --git a/MySQL/MySQLClientImpl.cpp b/MySQL/MySQLClientImpl.cpp index fb9f4a5..3ae5a73 100644 --- a/MySQL/MySQLClientImpl.cpp +++ b/MySQL/MySQLClientImpl.cpp @@ -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 MySQLClientImpl::ExecuteQuery(const std::string& query) @@ -127,6 +135,14 @@ std::shared_ptr 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(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()