From 561aedab1d91a3d966131b19ceb1f990176bb53d Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 21 Feb 2024 12:04:40 +0100 Subject: [PATCH] JsonRpcConnection: Raise an exception when trying to send to disconnected clients --- lib/remote/jsonrpcconnection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index 2c67b78d0..30f1a12db 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -166,7 +166,7 @@ ConnectionRole JsonRpcConnection::GetRole() const void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message) { if (m_ShuttingDown) { - return; + BOOST_THROW_EXCEPTION(std::runtime_error("Cannot send message to already disconnected API client '" + GetIdentity() + "'!")); } Ptr keepAlive (this); @@ -177,7 +177,7 @@ void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message) void JsonRpcConnection::SendRawMessage(const String& message) { if (m_ShuttingDown) { - return; + BOOST_THROW_EXCEPTION(std::runtime_error("Cannot send message to already disconnected API client '" + GetIdentity() + "'!")); } Ptr keepAlive (this);