aboutsummaryrefslogtreecommitdiff
path: root/zenserver-test/zenserver-test.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-24 15:55:42 +0100
committerMartin Ridgers <[email protected]>2021-11-24 16:17:44 +0100
commit83b627398263b293b41074dae139d754cd9cd822 (patch)
tree53132042abaaf14e1e0286c36f58257df814d8e0 /zenserver-test/zenserver-test.cpp
parentMoved librt dependency specification to zencore/xmake.lua (diff)
downloadzen-83b627398263b293b41074dae139d754cd9cd822.tar.xz
zen-83b627398263b293b41074dae139d754cd9cd822.zip
Raise an error if zenserver-test's HTTP clients are enable to connect
Diffstat (limited to 'zenserver-test/zenserver-test.cpp')
-rw-r--r--zenserver-test/zenserver-test.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index bc955727a..c83278fe7 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -332,6 +332,8 @@ HttpConnectionPool::~HttpConnectionPool()
std::unique_ptr<HttpClientConnection>
HttpConnectionPool::GetConnection()
{
+ using namespace fmt::literals;
+
zen::RwLock::ExclusiveLockScope ScopedLock(m_Lock);
if (m_AvailableConnections.empty())
@@ -347,7 +349,7 @@ HttpConnectionPool::GetConnection()
if (ErrCode)
{
- return nullptr;
+ zen::ThrowLastError("Unabled to resolve '{}'"_format(m_HostName));
}
asio::ip::tcp::socket Socket{m_Context};
@@ -355,7 +357,7 @@ HttpConnectionPool::GetConnection()
if (ErrCode)
{
- return nullptr;
+ zen::ThrowLastError("Failed connecting '{}:{}'"_format(m_HostName, m_Port));
}
return std::make_unique<HttpClientConnection>(m_Context, this, std::move(Socket));