diff options
Diffstat (limited to 'errs')
-rw-r--r-- | errs/errors.go | 22 | ||||
-rw-r--r-- | errs/errors_test.go | 21 |
2 files changed, 0 insertions, 43 deletions
diff --git a/errs/errors.go b/errs/errors.go index 675649efa..daa814db7 100644 --- a/errs/errors.go +++ b/errs/errors.go @@ -19,7 +19,6 @@ package errs import ( "fmt" - "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" ) @@ -32,15 +31,10 @@ Fields: Package: name of the package/component - - Level: - a function mapping error code to logger.LogLevel (severity) - if not given, errors default to logger.InfoLevel */ type Errors struct { Errors map[int]string Package string - Level func(code int) logger.LogLevel } /* @@ -58,7 +52,6 @@ type Error struct { Code int Name string Package string - level logger.LogLevel message string format string params []interface{} @@ -69,15 +62,10 @@ func (self *Errors) New(code int, format string, params ...interface{}) *Error { if !ok { panic("invalid error code") } - level := logger.InfoLevel - if self.Level != nil { - level = self.Level(code) - } return &Error{ Code: code, Name: name, Package: self.Package, - level: level, format: format, params: params, } @@ -98,13 +86,3 @@ func (self Error) Log(v glog.Verbose) { v.Infoln(self) } } - -/* -err.Fatal() is true if err's severity level is 0 or 1 (logger.ErrorLevel or logger.Silence) -*/ -func (self *Error) Fatal() (fatal bool) { - if self.level < logger.WarnLevel { - fatal = true - } - return -} diff --git a/errs/errors_test.go b/errs/errors_test.go index d6d14b45e..5a2ffbec3 100644 --- a/errs/errors_test.go +++ b/errs/errors_test.go @@ -19,8 +19,6 @@ package errs import ( "fmt" "testing" - - "github.com/ethereum/go-ethereum/logger" ) func testErrors() *Errors { @@ -30,14 +28,6 @@ func testErrors() *Errors { 0: "zero", 1: "one", }, - Level: func(i int) (l logger.LogLevel) { - if i == 0 { - l = logger.ErrorLevel - } else { - l = logger.WarnLevel - } - return - }, } } @@ -49,14 +39,3 @@ func TestErrorMessage(t *testing.T) { t.Errorf("error message incorrect. expected %v, got %v", exp, message) } } - -func TestErrorSeverity(t *testing.T) { - err0 := testErrors().New(0, "zero detail") - if !err0.Fatal() { - t.Errorf("error should be fatal") - } - err1 := testErrors().New(1, "one detail") - if err1.Fatal() { - t.Errorf("error should not be fatal") - } -} |