From 4315ec1a722a290ba2bb2b86080a787f6174e2a2 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Wed, 23 Oct 2013 16:19:49 +0200 Subject: RPC: error code changes and prevent crash with walletpassphrase - fix crash with walletpassphrase by checking if RPC server is running and give a friendly error message how to fix this (fixes #3100) - add 3 new RPCErrorCodes RPC_SERVER_NOT_STARTED, RPC_NODE_ALREADY_ADDED and RCP_NODE_NOT_ADDED (I checked the source to not use a number already in use for RPC_SERVER_NOT_STARTED) - use the new codes where needed / missing - add missing use of RPC_INVALID_PARAMETER --- src/rpcnet.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rpcnet.cpp') diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 3c92739852..5d87a2449f 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -27,7 +27,7 @@ Value ping(const Array& params, bool fHelp) "Requests that a ping be sent to all other nodes, to measure ping time.\n" "Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n" "Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping."); - + // Request that each node send a ping during next message processing pass LOCK(cs_vNodes); BOOST_FOREACH(CNode* pNode, vNodes) { @@ -120,13 +120,13 @@ Value addnode(const Array& params, bool fHelp) if (strCommand == "add") { if (it != vAddedNodes.end()) - throw JSONRPCError(-23, "Error: Node already added"); + throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: Node already added"); vAddedNodes.push_back(strNode); } else if(strCommand == "remove") { if (it == vAddedNodes.end()) - throw JSONRPCError(-24, "Error: Node has not been added."); + throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added."); vAddedNodes.erase(it); } @@ -163,7 +163,7 @@ Value getaddednodeinfo(const Array& params, bool fHelp) break; } if (laddedNodes.size() == 0) - throw JSONRPCError(-24, "Error: Node has not been added."); + throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added."); } if (!fDns) -- cgit v1.2.3