github.com/palcoin-project/palcd@v1.0.0/btcjson/jsonrpcerr.go (about) 1 // Copyright (c) 2014 The btcsuite developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package btcjson 6 7 // Standard JSON-RPC 2.0 errors. 8 var ( 9 ErrRPCInvalidRequest = &RPCError{ 10 Code: -32600, 11 Message: "Invalid request", 12 } 13 ErrRPCMethodNotFound = &RPCError{ 14 Code: -32601, 15 Message: "Method not found", 16 } 17 ErrRPCInvalidParams = &RPCError{ 18 Code: -32602, 19 Message: "Invalid parameters", 20 } 21 ErrRPCInternal = &RPCError{ 22 Code: -32603, 23 Message: "Internal error", 24 } 25 ErrRPCParse = &RPCError{ 26 Code: -32700, 27 Message: "Parse error", 28 } 29 ) 30 31 // General application defined JSON errors. 32 const ( 33 // ErrRPCMisc indicates an exception thrown during command handling. 34 ErrRPCMisc RPCErrorCode = -1 35 36 // ErrRPCForbiddenBySafeMode indicates that server is in safe mode, and 37 // command is not allowed in safe mode. 38 ErrRPCForbiddenBySafeMode RPCErrorCode = -2 39 40 // ErrRPCType indicates that an unexpected type was passed as parameter. 41 ErrRPCType RPCErrorCode = -3 42 43 // ErrRPCInvalidAddressOrKey indicates an invalid address or key. 44 ErrRPCInvalidAddressOrKey RPCErrorCode = -5 45 46 // ErrRPCOutOfMemory indicates that the server ran out of memory during 47 // operation. 48 ErrRPCOutOfMemory RPCErrorCode = -7 49 50 // ErrRPCInvalidParameter indicates an invalid, missing, or duplicate 51 // parameter. 52 ErrRPCInvalidParameter RPCErrorCode = -8 53 54 // ErrRPCDatabase indicates a database error. 55 ErrRPCDatabase RPCErrorCode = -20 56 57 // ErrRPCDeserialization indicates an error parsing or validating structure 58 // in raw format. 59 ErrRPCDeserialization RPCErrorCode = -22 60 61 // ErrRPCVerify indicates a general error during transaction or block 62 // submission. 63 ErrRPCVerify RPCErrorCode = -25 64 65 // ErrRPCVerifyRejected indicates that transaction or block was rejected by 66 // network rules. 67 ErrRPCVerifyRejected RPCErrorCode = -26 68 69 // ErrRPCVerifyAlreadyInChain indicates that submitted transaction is 70 // already in chain. 71 ErrRPCVerifyAlreadyInChain RPCErrorCode = -27 72 73 // ErrRPCInWarmup indicates that client is still warming up. 74 ErrRPCInWarmup RPCErrorCode = -28 75 76 // ErrRPCInWarmup indicates that the RPC error is deprecated. 77 ErrRPCMethodDeprecated RPCErrorCode = -32 78 ) 79 80 // Peer-to-peer client errors. 81 const ( 82 // ErrRPCClientNotConnected indicates that Bitcoin is not connected. 83 ErrRPCClientNotConnected RPCErrorCode = -9 84 85 // ErrRPCClientInInitialDownload indicates that client is still downloading 86 // initial blocks. 87 ErrRPCClientInInitialDownload RPCErrorCode = -10 88 89 // ErrRPCClientNodeAlreadyAdded indicates that node is already added. 90 ErrRPCClientNodeAlreadyAdded RPCErrorCode = -23 91 92 // ErrRPCClientNodeNotAdded indicates that node has not been added before. 93 ErrRPCClientNodeNotAdded RPCErrorCode = -24 94 95 // ErrRPCClientNodeNotConnected indicates that node to disconnect was not 96 // found in connected nodes. 97 ErrRPCClientNodeNotConnected RPCErrorCode = -29 98 99 // ErrRPCClientInvalidIPOrSubnet indicates an invalid IP/Subnet. 100 ErrRPCClientInvalidIPOrSubnet RPCErrorCode = -30 101 102 // ErrRPCClientP2PDisabled indicates that no valid connection manager 103 // instance was found. 104 ErrRPCClientP2PDisabled RPCErrorCode = -31 105 ) 106 107 // Chain errors 108 const ( 109 // ErrRPCClientMempoolDisabled indicates that no mempool instance was 110 // found. 111 ErrRPCClientMempoolDisabled RPCErrorCode = -33 112 ) 113 114 // Wallet JSON errors 115 const ( 116 // ErrRPCWallet indicates an unspecified problem with wallet, for 117 // example, key not found, etc. 118 ErrRPCWallet RPCErrorCode = -4 119 120 // ErrRPCWalletInsufficientFunds indicates that there are not enough 121 // funds in wallet or account. 122 ErrRPCWalletInsufficientFunds RPCErrorCode = -6 123 124 // ErrRPCWalletInvalidAccountName indicates an invalid label name. 125 ErrRPCWalletInvalidAccountName RPCErrorCode = -11 126 127 // ErrRPCWalletKeypoolRanOut indicates that the keypool ran out, and that 128 // keypoolrefill must be called first. 129 ErrRPCWalletKeypoolRanOut RPCErrorCode = -12 130 131 // ErrRPCWalletUnlockNeeded indicates that the wallet passphrase must be 132 // entered first with the walletpassphrase RPC. 133 ErrRPCWalletUnlockNeeded RPCErrorCode = -13 134 135 // ErrRPCWalletPassphraseIncorrect indicates that the wallet passphrase 136 // that was entered was incorrect. 137 ErrRPCWalletPassphraseIncorrect RPCErrorCode = -14 138 139 // ErrRPCWalletWrongEncState indicates that a command was given in wrong 140 // wallet encryption state, for example, encrypting an encrypted wallet. 141 ErrRPCWalletWrongEncState RPCErrorCode = -15 142 143 // ErrRPCWalletEncryptionFailed indicates a failure to encrypt the wallet. 144 ErrRPCWalletEncryptionFailed RPCErrorCode = -16 145 146 // ErrRPCWalletAlreadyUnlocked indicates an attempt to unlock a wallet 147 // that was already unlocked. 148 ErrRPCWalletAlreadyUnlocked RPCErrorCode = -17 149 150 // ErrRPCWalletNotFound indicates that an invalid wallet was specified, 151 // which does not exist. It can also indicate an attempt to unload a 152 // wallet that was not previously loaded. 153 // 154 // Not to be confused with ErrRPCNoWallet, which is specific to palcd. 155 ErrRPCWalletNotFound RPCErrorCode = -18 156 157 // ErrRPCWalletNotSpecified indicates that no wallet was specified, for 158 // example, when there are multiple wallets loaded. 159 ErrRPCWalletNotSpecified RPCErrorCode = -19 160 ) 161 162 // Specific Errors related to commands. These are the ones a user of the RPC 163 // server are most likely to see. Generally, the codes should match one of the 164 // more general errors above. 165 const ( 166 ErrRPCBlockNotFound RPCErrorCode = -5 167 ErrRPCBlockCount RPCErrorCode = -5 168 ErrRPCBestBlockHash RPCErrorCode = -5 169 ErrRPCDifficulty RPCErrorCode = -5 170 ErrRPCOutOfRange RPCErrorCode = -1 171 ErrRPCNoTxInfo RPCErrorCode = -5 172 ErrRPCNoCFIndex RPCErrorCode = -5 173 ErrRPCNoNewestBlockInfo RPCErrorCode = -5 174 ErrRPCInvalidTxVout RPCErrorCode = -5 175 ErrRPCRawTxString RPCErrorCode = -32602 176 ErrRPCDecodeHexString RPCErrorCode = -22 177 ErrRPCTxError RPCErrorCode = -25 178 ErrRPCTxRejected RPCErrorCode = -26 179 ErrRPCTxAlreadyInChain RPCErrorCode = -27 180 ) 181 182 // Errors that are specific to palcd. 183 const ( 184 ErrRPCNoWallet RPCErrorCode = -1 185 ErrRPCUnimplemented RPCErrorCode = -1 186 )