Merge pull request #5687 from Icinga/fix/jsonrpc-error-message-#5686

Improve error message for unknown cluster message functions
This commit is contained in:
Michael Friedrich 2017-10-18 17:10:37 +02:00 committed by GitHub
commit 55e708946c
1 changed files with 4 additions and 3 deletions

View File

@ -209,8 +209,9 @@ void JsonRpcConnection::MessageHandler(const String& jsonString)
ApiFunction::Ptr afunc = ApiFunction::GetByName(method);
if (!afunc)
BOOST_THROW_EXCEPTION(std::invalid_argument("Function '" + method + "' does not exist."));
Log(LogWarning, "JsonRpcConnection")
<< "Call to non-existent function '" << method << "' from endpoint '" << m_Identity << "'.";
else
resultMessage->Set("result", afunc->Invoke(origin, message->Get("params")));
} catch (const std::exception& ex) {
/* TODO: Add a user readable error message for the remote caller */