aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/errors.go
blob: 209b64c7d7ffcb23a64c5e6f0d9e3dc7647199aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package vm

import (
    "errors"
    "fmt"

    "github.com/ethereum/go-ethereum/params"
)

var OutOfGasError = errors.New("Out of gas")
var DepthError = fmt.Errorf("Max call depth exceeded (%d)", params.CallCreateDepth)

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 IsStackErr(err error) bool {
    _, ok := err.(StackError)
    return ok
}