github.com/dashpay/godash@v0.0.0-20160726055534-e038a21e0e3d/btcjson/jsonrpcerr.go (about)

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