aboutsummaryrefslogtreecommitdiffstats
path: root/eth/error.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-01 03:52:57 +0800
committerobscuren <geffobscura@gmail.com>2015-03-01 03:52:57 +0800
commit73c52d1677ba526385f1b223ef48f3a26091fe00 (patch)
treeb7414552192d8e7520a2df8353677a5f19231866 /eth/error.go
parentae45a39dc1cddac885090872cefc6799b4a4c1d9 (diff)
parentc18ea4de147cb81bf5563a5727172d4103658b92 (diff)
downloaddexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.gz
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.bz2
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.lz
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.xz
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.tar.zst
dexon-73c52d1677ba526385f1b223ef48f3a26091fe00.zip
Merge branch 'ethersphere-blockpool2' into poc-9
Diffstat (limited to 'eth/error.go')
-rw-r--r--eth/error.go72
1 files changed, 0 insertions, 72 deletions
diff --git a/eth/error.go b/eth/error.go
deleted file mode 100644
index 9c4a68481..000000000
--- a/eth/error.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package eth
-
-import (
- "fmt"
-)
-
-const (
- ErrMsgTooLarge = iota
- ErrDecode
- ErrInvalidMsgCode
- ErrProtocolVersionMismatch
- ErrNetworkIdMismatch
- ErrGenesisBlockMismatch
- ErrNoStatusMsg
- ErrExtraStatusMsg
- ErrInvalidBlock
- ErrInvalidPoW
- ErrUnrequestedBlock
- ErrInsufficientChainInfo
-)
-
-var errorToString = map[int]string{
- ErrMsgTooLarge: "Message too long",
- ErrDecode: "Invalid message",
- ErrInvalidMsgCode: "Invalid message code",
- ErrProtocolVersionMismatch: "Protocol version mismatch",
- ErrNetworkIdMismatch: "NetworkId mismatch",
- ErrGenesisBlockMismatch: "Genesis block mismatch",
- ErrNoStatusMsg: "No status message",
- ErrExtraStatusMsg: "Extra status message",
- ErrInvalidBlock: "Invalid block",
- ErrInvalidPoW: "Invalid PoW",
- ErrUnrequestedBlock: "Unrequested block",
- ErrInsufficientChainInfo: "Insufficient chain info",
-}
-
-type protocolError struct {
- Code int
- fatal bool
- message string
- format string
- params []interface{}
- // size int
-}
-
-func newProtocolError(code int, format string, params ...interface{}) *protocolError {
- return &protocolError{Code: code, format: format, params: params}
-}
-
-func ProtocolError(code int, format string, params ...interface{}) (err *protocolError) {
- err = newProtocolError(code, format, params...)
- // report(err)
- return
-}
-
-func (self protocolError) Error() (message string) {
- if len(message) == 0 {
- var ok bool
- self.message, ok = errorToString[self.Code]
- if !ok {
- panic("invalid error code")
- }
- if self.format != "" {
- self.message += ": " + fmt.Sprintf(self.format, self.params...)
- }
- }
- return self.message
-}
-
-func (self *protocolError) Fatal() bool {
- return self.fatal
-}