Improve error handling
This commit is contained in:
parent
457b09f15c
commit
80272e81c3
5 changed files with 68 additions and 84 deletions
|
|
@ -427,7 +427,7 @@ void ASyncDBConnection::closeConnection()
|
|||
|
||||
bool ASyncDBConnection::send(const std::string &command, on_result_callback on_result)
|
||||
{
|
||||
if (command.empty())
|
||||
if (command.empty() || state() == State::NotConnected)
|
||||
return false;
|
||||
|
||||
{
|
||||
|
|
@ -440,7 +440,10 @@ bool ASyncDBConnection::send(const std::string &command, on_result_callback on_r
|
|||
|
||||
bool ASyncDBConnection::send(const std::string &command, Pgsql::Params params, on_result_callback on_result)
|
||||
{
|
||||
{
|
||||
if (command.empty() || state() == State::NotConnected)
|
||||
return false;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lg(m_threadData->m_commandQueue.m_mutex);
|
||||
m_threadData->m_commandQueue.m_queue.emplace(command, std::move(params), on_result);
|
||||
m_threadData->m_commandQueue.m_newEvent.set();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue