Skip to content

Commit 5ff044a

Browse files
committed
JsonRpcConnection: Raise an exception when trying to send to disconnected clients
1 parent ba3515f commit 5ff044a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/remote/jsonrpcconnection.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ConnectionRole JsonRpcConnection::GetRole() const
164164
void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
165165
{
166166
if (m_ShuttingDown) {
167-
return;
167+
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot send message to already disconnected API client '" + GetIdentity() + "'!"));
168168
}
169169

170170
Ptr keepAlive (this);
@@ -175,7 +175,7 @@ void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
175175
void JsonRpcConnection::SendRawMessage(const String& message)
176176
{
177177
if (m_ShuttingDown) {
178-
return;
178+
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot send message to already disconnected API client '" + GetIdentity() + "'!"));
179179
}
180180

181181
Ptr keepAlive (this);

0 commit comments

Comments
 (0)