@@ -53,19 +53,19 @@ void checkBudgetInputs(const UniValue& params, std::string &strProposalName, std
5353{
5454 strProposalName = SanitizeString (params[0 ].get_str ());
5555 if (strProposalName.size () > 20 )
56- throw std::runtime_error ( " Invalid proposal name, limit of 20 characters." );
56+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid proposal name, limit of 20 characters." );
5757
5858 strURL = SanitizeString (params[1 ].get_str ());
5959 if (strURL.size () > 64 )
60- throw std::runtime_error ( " Invalid url, limit of 64 characters." );
60+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid url, limit of 64 characters." );
6161
6262 nPaymentCount = params[2 ].get_int ();
6363 if (nPaymentCount < 1 )
64- throw std::runtime_error ( " Invalid payment count, must be more than zero." );
64+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid payment count, must be more than zero." );
6565
6666 CBlockIndex* pindexPrev = chainActive.Tip ();
67- if (pindexPrev == NULL )
68- throw std::runtime_error ( " Try again after active chain is loaded" );
67+ if (! pindexPrev)
68+ throw JSONRPCError (RPC_IN_WARMUP, " Try again after active chain is loaded" );
6969
7070 // Start must be in the next budget cycle or later
7171 const int budgetCycleBlocks = Params ().GetBudgetCycleBlocks ();
@@ -75,7 +75,7 @@ void checkBudgetInputs(const UniValue& params, std::string &strProposalName, std
7575
7676 nBlockStart = params[3 ].get_int ();
7777 if ((nBlockStart < nBlockMin) || ((nBlockStart % budgetCycleBlocks) != 0 )) {
78- throw std::runtime_error ( strprintf (" Invalid block start - must be a budget cycle block. Next valid block: %d" , nBlockMin));
78+ throw JSONRPCError (RPC_INVALID_PARAMETER, strprintf (" Invalid block start - must be a budget cycle block. Next valid block: %d" , nBlockMin));
7979 }
8080
8181 address = params[4 ].get_str ();
@@ -108,7 +108,7 @@ UniValue preparebudget(const UniValue& params, bool fHelp)
108108 HelpExampleRpc (" preparebudget" , " \" test-proposal\" \" https://forum.pivx.org/t/test-proposal\" 2 820800 \" D9oc6C3dttUbv8zd7zGNq1qKBGf4ZQ1XEE\" 500" ));
109109
110110 if (!pwalletMain) {
111- throw std::runtime_error ( " Try again after wallet is fully started " );
111+ throw JSONRPCError (RPC_IN_WARMUP, " Try again after active chain is loaded " );
112112 }
113113
114114 LOCK2 (cs_main, pwalletMain->cs_wallet );
0 commit comments