diff options
| author | Pieter Wuille <[email protected]> | 2012-10-04 17:17:53 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2012-10-04 17:17:53 -0700 |
| commit | 39930ca6ae5ca00f62ad11d903626e0d4354c87c (patch) | |
| tree | b2fcb63f1b76462c7c8a26c28e84605a1b851b54 /src/rpcdump.cpp | |
| parent | Merge pull request #1907 from laanwj/2012_10_translations (diff) | |
| parent | Add constants for HTTP status codes (diff) | |
| download | discoin-39930ca6ae5ca00f62ad11d903626e0d4354c87c.tar.xz discoin-39930ca6ae5ca00f62ad11d903626e0d4354c87c.zip | |
Merge pull request #1908 from laanwj/2012_10_rpcerrors
Document RPC error codes
Diffstat (limited to 'src/rpcdump.cpp')
| -rw-r--r-- | src/rpcdump.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index 30e504a09..55d5d79e2 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -46,7 +46,7 @@ Value importprivkey(const Array& params, bool fHelp) CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(strSecret); - if (!fGood) throw JSONRPCError(-5,"Invalid private key"); + if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key"); CKey key; bool fCompressed; @@ -60,7 +60,7 @@ Value importprivkey(const Array& params, bool fHelp) pwalletMain->SetAddressBookName(vchAddress, strLabel); if (!pwalletMain->AddKey(key)) - throw JSONRPCError(-4,"Error adding key to wallet"); + throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); pwalletMain->ScanForWalletTransactions(pindexGenesisBlock, true); pwalletMain->ReacceptWalletTransactions(); @@ -79,13 +79,13 @@ Value dumpprivkey(const Array& params, bool fHelp) string strAddress = params[0].get_str(); CBitcoinAddress address; if (!address.SetString(strAddress)) - throw JSONRPCError(-5, "Invalid Bitcoin address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); CKeyID keyID; if (!address.GetKeyID(keyID)) - throw JSONRPCError(-3, "Address does not refer to a key"); + throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key"); CSecret vchSecret; bool fCompressed; if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed)) - throw JSONRPCError(-4,"Private key for address " + strAddress + " is not known"); + throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known"); return CBitcoinSecret(vchSecret, fCompressed).ToString(); } |