aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/error.go')
-rw-r--r--ethchain/error.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/ethchain/error.go b/ethchain/error.go
index 0f1d061c0..8d37b0208 100644
--- a/ethchain/error.go
+++ b/ethchain/error.go
@@ -1,6 +1,8 @@
package ethchain
-import "fmt"
+import (
+ "fmt"
+)
// Parent error. In case a parent is unknown this error will be thrown
// by the block manager
@@ -40,3 +42,22 @@ func IsValidationErr(err error) bool {
return ok
}
+
+type NonceErr struct {
+ Message string
+ Is, Exp uint64
+}
+
+func (err *NonceErr) Error() string {
+ return err.Message
+}
+
+func NonceError(is, exp uint64) *NonceErr {
+ return &NonceErr{Message: fmt.Sprintf("Nonce err. Is %d, expected %d", is, exp), Is: is, Exp: exp}
+}
+
+func IsNonceErr(err error) bool {
+ _, ok := err.(*NonceErr)
+
+ return ok
+}