jsonrpcerr.go raw

   1  package btcjson
   2  
   3  // General application defined JSON errors.
   4  const (
   5  	ErrRPCMisc                RPCErrorCode = -1
   6  	ErrRPCForbiddenBySafeMode RPCErrorCode = -2
   7  	ErrRPCType                RPCErrorCode = -3
   8  	ErrRPCInvalidAddressOrKey RPCErrorCode = -5
   9  	ErrRPCOutOfMemory         RPCErrorCode = -7
  10  	ErrRPCInvalidParameter    RPCErrorCode = -8
  11  	ErrRPCDatabase            RPCErrorCode = -20
  12  	ErrRPCDeserialization     RPCErrorCode = -22
  13  	ErrRPCVerify              RPCErrorCode = -25
  14  	// Peer-to-peer client errors.
  15  	ErrRPCClientNotConnected      RPCErrorCode = -9
  16  	ErrRPCClientInInitialDownload RPCErrorCode = -10
  17  	ErrRPCClientNodeNotAdded      RPCErrorCode = -24
  18  	// Wallet JSON errors
  19  	ErrRPCWallet                    RPCErrorCode = -4
  20  	ErrRPCWalletInsufficientFunds   RPCErrorCode = -6
  21  	ErrRPCWalletInvalidAccountName  RPCErrorCode = -11
  22  	ErrRPCWalletKeypoolRanOut       RPCErrorCode = -12
  23  	ErrRPCWalletUnlockNeeded        RPCErrorCode = -13
  24  	ErrRPCWalletPassphraseIncorrect RPCErrorCode = -14
  25  	ErrRPCWalletWrongEncState       RPCErrorCode = -15
  26  	ErrRPCWalletEncryptionFailed    RPCErrorCode = -16
  27  	ErrRPCWalletAlreadyUnlocked     RPCErrorCode = -17
  28  	
  29  	// Specific Errors related to commands. These are the ones a user of the RPC server are most likely to see.
  30  	// Generally, the codes should match one of the more general errors above.
  31  	
  32  	ErrRPCBlockNotFound     RPCErrorCode = -5
  33  	ErrRPCBlockCount        RPCErrorCode = -5
  34  	ErrRPCBestBlockHash     RPCErrorCode = -5
  35  	ErrRPCDifficulty        RPCErrorCode = -5
  36  	ErrRPCOutOfRange        RPCErrorCode = -1
  37  	ErrRPCNoTxInfo          RPCErrorCode = -5
  38  	ErrRPCNoCFIndex         RPCErrorCode = -5
  39  	ErrRPCNoNewestBlockInfo RPCErrorCode = -5
  40  	ErrRPCInvalidTxVout     RPCErrorCode = -5
  41  	ErrRPCRawTxString       RPCErrorCode = -32602
  42  	ErrRPCDecodeHexString   RPCErrorCode = -22
  43  	// Errors that are specific to pod.
  44  	ErrRPCNoWallet      RPCErrorCode = -1
  45  	ErrRPCNoChain       RPCErrorCode = -1
  46  	ErrRPCUnimplemented RPCErrorCode = -1
  47  )
  48  
  49  // Standard JSON-RPC 2.0 errors.
  50  var (
  51  	ErrRPCInternal = &RPCError{
  52  		Code:    -32603,
  53  		Message: "Internal error",
  54  	}
  55  	// Standard JSON-RPC 2.0 errors.
  56  	ErrRPCInvalidParams = &RPCError{
  57  		Code:    -32602,
  58  		Message: "Invalid parameters",
  59  	}
  60  	// Standard JSON-RPC 2.0 errors.
  61  	ErrRPCInvalidRequest = &RPCError{
  62  		Code:    -32600,
  63  		Message: "Invalid request",
  64  	}
  65  	// Standard JSON-RPC 2.0 errors.
  66  	ErrRPCMethodNotFound = &RPCError{
  67  		Code:    -32601,
  68  		Message: "Method not found",
  69  	}
  70  	// Standard JSON-RPC 2.0 errors.
  71  	ErrRPCParse = &RPCError{
  72  		Code:    -32700,
  73  		Message: "Parse error",
  74  	}
  75  )
  76