Improve error message for unknow functions 5687/head
authorJean Flach <jean-marcel.flach@icinga.com>
Wed, 18 Oct 2017 09:08:55 +0000 (11:08 +0200)
committerJean Flach <jean-marcel.flach@icinga.com>
Wed, 18 Oct 2017 09:25:38 +0000 (11:25 +0200)
refs #5686

lib/remote/jsonrpcconnection.cpp

index a40d6ea6908a0f5caec0c453196743b02adbae50..3d9cacaf0c0c55eaef6f6dfffcb15a5dab8b0eff 100644 (file)
@@ -209,9 +209,10 @@ 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."));
-
-               resultMessage->Set("result", afunc->Invoke(origin, message->Get("params")));
+                       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 */
                String diagInfo = DiagnosticInformation(ex);