summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpippijn <pippijn@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-17 13:04:36 +0000
committerpippijn <pippijn@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-17 13:04:36 +0000
commiteb8fbc12e2848baf01296eedad75f0d4fb870f79 (patch)
treedbbdd9bd97049c93b14a5c8e54b91bda22391b84 /src
parent6274504ba37678896034fb6933b5f4a4425a3238 (diff)
provide feedback to the user if json throws an exception
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7462 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_rpc_json.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/modules/m_rpc_json.cpp b/src/modules/m_rpc_json.cpp
index 1cbbcf254..5977eb36e 100644
--- a/src/modules/m_rpc_json.cpp
+++ b/src/modules/m_rpc_json.cpp
@@ -46,16 +46,16 @@ class ModuleRpcJson : public Module
if (http->GetURI() == "/jsonrpc" && http->GetType() == "POST")
{
- std::string response_text;
- try
- {
- json::rpc::process (http, response_text, http->GetPostData().c_str());
- }
- catch (std::runtime_error &)
- {
- // ignore
- }
- data << response_text;
+ try
+ {
+ std::string response_text;
+ json::rpc::process (http, response_text, http->GetPostData().c_str());
+ data << response_text;
+ }
+ catch (std::runtime_error &)
+ {
+ data << "{ \"result\": \"JSON Fault\", \"error\": \"Invalid RPC call\", \"id\": 1}";
+ }
/* Send the document back to m_httpd */
HTTPDocument response(http->sock, &data, 200, "X-Powered-By: m_rpc_json.so\r\n"