mirror of https://github.com/Icinga/icinga2.git
Merge pull request #5687 from Icinga/fix/jsonrpc-error-message-#5686
Improve error message for unknown cluster message functions
This commit is contained in:
commit
55e708946c
|
@ -209,8 +209,9 @@ void JsonRpcConnection::MessageHandler(const String& jsonString)
|
||||||
ApiFunction::Ptr afunc = ApiFunction::GetByName(method);
|
ApiFunction::Ptr afunc = ApiFunction::GetByName(method);
|
||||||
|
|
||||||
if (!afunc)
|
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")));
|
resultMessage->Set("result", afunc->Invoke(origin, message->Get("params")));
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
/* TODO: Add a user readable error message for the remote caller */
|
/* TODO: Add a user readable error message for the remote caller */
|
||||||
|
|
Loading…
Reference in New Issue