diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-10 08:22:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-10 08:22:38 +0800 |
commit | 0db4a0e898d09ffa7b6b1289e9a334edc0001cfa (patch) | |
tree | a0b5c8381ab482550ef4800a06d4db086d76a983 /core/error.go | |
parent | 94e543bc398efbb5c712b6e4cb48d8a57eb3400d (diff) | |
parent | 0d64163fea3a266ceb71cb4c4ee5682052c9ca6c (diff) | |
download | dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.gz dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.bz2 dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.lz dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.xz dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.zst dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.zip |
Merge branch 'poc-9' into develop
Diffstat (limited to 'core/error.go')
-rw-r--r-- | core/error.go | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/core/error.go b/core/error.go index e86bacb2d..04e40646c 100644 --- a/core/error.go +++ b/core/error.go @@ -22,7 +22,7 @@ func (err *ParentErr) Error() string { } func ParentError(hash []byte) error { - return &ParentErr{Message: fmt.Sprintf("Block's parent unkown %x", hash)} + return &ParentErr{Message: fmt.Sprintf("Block's parent unknown %x", hash)} } func IsParentErr(err error) bool { @@ -87,6 +87,24 @@ func IsNonceErr(err error) bool { return ok } +type InvalidTxErr struct { + Message string +} + +func (err *InvalidTxErr) Error() string { + return err.Message +} + +func InvalidTxError(err error) *InvalidTxErr { + return &InvalidTxErr{fmt.Sprintf("%v", err)} +} + +func IsInvalidTxErr(err error) bool { + _, ok := err.(*InvalidTxErr) + + return ok +} + type OutOfGasErr struct { Message string } @@ -128,3 +146,19 @@ func IsKnownBlockErr(e error) bool { _, ok := e.(*KnownBlockError) return ok } + +type ValueTransferError struct { + message string +} + +func ValueTransferErr(str string, v ...interface{}) *ValueTransferError { + return &ValueTransferError{fmt.Sprintf(str, v...)} +} + +func (self *ValueTransferError) Error() string { + return self.message +} +func IsValueTransferErr(e error) bool { + _, ok := e.(*ValueTransferError) + return ok +} |