aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/errors.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-23 23:59:09 +0800
committerobscuren <geffobscura@gmail.com>2015-03-23 23:59:09 +0800
commit0330077d76b48934ab024a309000f83c78047d8a (patch)
tree2a3ffbcd5bd941b30ed28d0eb5c30553a25324e0 /core/vm/errors.go
parentd7eaa97a297151637af090ecb05bbd6d260d90b8 (diff)
downloadgo-tangerine-0330077d76b48934ab024a309000f83c78047d8a.tar
go-tangerine-0330077d76b48934ab024a309000f83c78047d8a.tar.gz
go-tangerine-0330077d76b48934ab024a309000f83c78047d8a.tar.bz2
go-tangerine-0330077d76b48934ab024a309000f83c78047d8a.tar.lz
go-tangerine-0330077d76b48934ab024a309000f83c78047d8a.tar.xz
go-tangerine-0330077d76b48934ab024a309000f83c78047d8a.tar.zst
go-tangerine-0330077d76b48934ab024a309000f83c78047d8a.zip
moved state and vm to core
Diffstat (limited to 'core/vm/errors.go')
-rw-r--r--core/vm/errors.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/core/vm/errors.go b/core/vm/errors.go
new file mode 100644
index 000000000..ab011bd62
--- /dev/null
+++ b/core/vm/errors.go
@@ -0,0 +1,51 @@
+package vm
+
+import (
+ "fmt"
+ "math/big"
+)
+
+type OutOfGasError struct {
+ req, has *big.Int
+}
+
+func OOG(req, has *big.Int) OutOfGasError {
+ return OutOfGasError{req, has}
+}
+
+func (self OutOfGasError) Error() string {
+ return fmt.Sprintf("out of gas! require %v, have %v", self.req, self.has)
+}
+
+func IsOOGErr(err error) bool {
+ _, ok := err.(OutOfGasError)
+ return ok
+}
+
+type StackError struct {
+ req, has int
+}
+
+func StackErr(req, has int) StackError {
+ return StackError{req, has}
+}
+
+func (self StackError) Error() string {
+ return fmt.Sprintf("stack error! require %v, have %v", self.req, self.has)
+}
+
+func IsStack(err error) bool {
+ _, ok := err.(StackError)
+ return ok
+}
+
+type DepthError struct{}
+
+func (self DepthError) Error() string {
+ return fmt.Sprintf("Max call depth exceeded (%d)", MaxCallDepth)
+}
+
+func IsDepthErr(err error) bool {
+ _, ok := err.(DepthError)
+ return ok
+}