PoolWithFailover: Better error reporting [#CONV-8589].

This commit is contained in:
Alexey Milovidov 2013-08-28 01:21:53 +00:00
parent 3f72d27c61
commit bd69b6d606

View File

@ -142,7 +142,7 @@ namespace mysqlxx
return entry;
}
}
catch (Poco::Exception & e)
catch (const Poco::Exception & e)
{
if (e.displayText() == "mysqlxx::Pool is full")
{
@ -150,7 +150,10 @@ namespace mysqlxx
}
app.logger().error("Connection to " + replica.pool->getDescription() + " failed: " + e.displayText());
continue;
}
app.logger().error("Connection to " + replica.pool->getDescription() + " failed.");
}
}
@ -163,7 +166,13 @@ namespace mysqlxx
return full_pool->pool->Get();
}
throw Poco::Exception("Connections to all replicas failed");
std::stringstream message;
message << "Connections to all replicas failed: ";
for (ReplicasByPriority::const_iterator it = replicas_by_priority.begin(); it != replicas_by_priority.end(); ++it)
for (Replicas::const_iterator jt = it->second.begin(); jt != it->second.end(); ++jt)
message << (it == replicas_by_priority.begin() && jt == it->second.begin() ? "" : ", ") << jt->pool->getDescription();
throw Poco::Exception(message.str());
}
};
}