Add extra catch statements
This commit is contained in:
@@ -95,6 +95,14 @@ void MySQLClientImpl::Execute(const std::string& query)
|
|||||||
if (errorCode == 2006 || errorCode == 2013)
|
if (errorCode == 2006 || errorCode == 2013)
|
||||||
InternalDisconnect();
|
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)
|
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)
|
if (errorCode == 2006 || errorCode == 2013)
|
||||||
InternalDisconnect();
|
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);
|
return std::make_shared<MySQLResultSetImpl>(nullptr);
|
||||||
}
|
}
|
||||||
@@ -162,6 +178,13 @@ void MySQLClientImpl::InternalConnect()
|
|||||||
Logging::Log(Logging::Severity::Error, ss.str());
|
Logging::Log(Logging::Severity::Error, ss.str());
|
||||||
InternalDisconnect();
|
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()
|
void MySQLClientImpl::InternalDisconnect()
|
||||||
|
|||||||
Reference in New Issue
Block a user