OSDN Git Service

delete redundant error (#1267)
authoroysheng <33340252+oysheng@users.noreply.github.com>
Thu, 23 Aug 2018 02:14:11 +0000 (10:14 +0800)
committerPaladz <yzhu101@uottawa.ca>
Thu, 23 Aug 2018 02:14:11 +0000 (10:14 +0800)
api/errors.go
blockchain/pseudohsm/pseudohsm.go
blockchain/signers/signers.go
protocol/protocol.go

index e7dd7b9..e80c591 100644 (file)
@@ -12,7 +12,6 @@ import (
        "github.com/bytom/errors"
        "github.com/bytom/net/http/httperror"
        "github.com/bytom/net/http/httpjson"
-       "github.com/bytom/protocol"
        "github.com/bytom/protocol/validation"
        "github.com/bytom/protocol/vm"
 )
@@ -49,8 +48,7 @@ var respErrFormatter = map[error]httperror.Info{
        signers.ErrBadQuorum: {400, "BTM200", "Quorum must be greater than 1 and less than or equal to the length of xpubs"},
        signers.ErrBadXPub:   {400, "BTM201", "Invalid xpub format"},
        signers.ErrNoXPubs:   {400, "BTM202", "At least one xpub is required"},
-       signers.ErrBadType:   {400, "BTM203", "Retrieved type does not match expected type"},
-       signers.ErrDupeXPub:  {400, "BTM204", "Root XPubs cannot contain the same key more than once"},
+       signers.ErrDupeXPub:  {400, "BTM203", "Root XPubs cannot contain the same key more than once"},
 
        // Transaction error namespace (7xx)
        // Build transaction error namespace (70x ~ 72x)
@@ -108,11 +106,9 @@ var respErrFormatter = map[error]httperror.Info{
        vm.ErrVerifyFailed:       {400, "BTM775", "VERIFY failed"},
 
        // Mock HSM error namespace (8xx)
-       pseudohsm.ErrDuplicateKeyAlias:    {400, "BTM800", "Key Alias already exists"},
-       pseudohsm.ErrInvalidAfter:         {400, "BTM801", "Invalid `after` in query"},
-       pseudohsm.ErrLoadKey:              {400, "BTM802", "Key not found or wrong password"},
-       pseudohsm.ErrTooManyAliasesToList: {400, "BTM803", "Requested key aliases exceeds limit"},
-       pseudohsm.ErrDecrypt:              {400, "BTM804", "Could not decrypt key with given passphrase"},
+       pseudohsm.ErrDuplicateKeyAlias: {400, "BTM800", "Key Alias already exists"},
+       pseudohsm.ErrLoadKey:           {400, "BTM801", "Key not found or wrong password"},
+       pseudohsm.ErrDecrypt:           {400, "BTM802", "Could not decrypt key with given passphrase"},
 }
 
 // Map error values to standard bytom error codes. Missing entries
@@ -125,10 +121,9 @@ var errorFormatter = httperror.Formatter{
        IsTemporary: isTemporary,
        Errors: map[error]httperror.Info{
                // General error namespace (0xx)
-               context.DeadlineExceeded:     {408, "BTM001", "Request timed out"},
-               httpjson.ErrBadRequest:       {400, "BTM002", "Invalid request body"},
-               rpc.ErrWrongNetwork:          {502, "BTM103", "A peer core is operating on a different blockchain network"},
-               protocol.ErrTheDistantFuture: {400, "BTM104", "Requested height is too far ahead"},
+               context.DeadlineExceeded: {408, "BTM001", "Request timed out"},
+               httpjson.ErrBadRequest:   {400, "BTM002", "Invalid request body"},
+               rpc.ErrWrongNetwork:      {502, "BTM103", "A peer core is operating on a different blockchain network"},
 
                //accesstoken authz err namespace (86x)
                errNotAuthenticated: {401, "BTM860", "Request could not be authenticated"},
index a94a070..ed1d7f9 100644 (file)
@@ -14,12 +14,9 @@ import (
 
 // pre-define errors for supporting bytom errorFormatter
 var (
-       ErrDuplicateKeyAlias    = errors.New("duplicate key alias")
-       ErrDuplicateKey         = errors.New("duplicate key")
-       ErrInvalidAfter         = errors.New("invalid after")
-       ErrLoadKey              = errors.New("key not found or wrong password ")
-       ErrTooManyAliasesToList = errors.New("requested aliases exceeds limit")
-       ErrDecrypt              = errors.New("could not decrypt key with given passphrase")
+       ErrDuplicateKeyAlias = errors.New("duplicate key alias")
+       ErrLoadKey           = errors.New("key not found or wrong password ")
+       ErrDecrypt           = errors.New("could not decrypt key with given passphrase")
 )
 
 // HSM type for storing pubkey and privatekey
index c9d1278..c8db6db 100644 (file)
@@ -31,10 +31,6 @@ var (
        // slice provided is empty.
        ErrNoXPubs = errors.New("at least one xpub is required")
 
-       // ErrBadType is returned when a find operation
-       // retrieves a signer that is not the expected type.
-       ErrBadType = errors.New("retrieved type does not match expected type")
-
        // ErrDupeXPub is returned by create when the same xpub
        // appears twice in a single call.
        ErrDupeXPub = errors.New("xpubs cannot contain the same key more than once")
index 015cb94..38592dd 100644 (file)
@@ -14,10 +14,6 @@ import (
 
 const maxProcessBlockChSize = 1024
 
-// ErrTheDistantFuture is returned when waiting for a blockheight too far in
-// excess of the tip of the blockchain.
-var ErrTheDistantFuture = errors.New("block height too far in future")
-
 // Chain provides functions for working with the Bytom block chain.
 type Chain struct {
        index          *state.BlockIndex