2014-10-23 12:04:00 +00:00
|
|
|
package vm
|
|
|
|
|
|
|
|
import (
|
2015-07-03 17:54:14 +00:00
|
|
|
"errors"
|
2014-10-23 12:04:00 +00:00
|
|
|
"fmt"
|
2015-06-12 11:35:14 +00:00
|
|
|
|
2015-04-02 03:17:15 +00:00
|
|
|
"github.com/ethereum/go-ethereum/params"
|
2014-10-23 12:04:00 +00:00
|
|
|
)
|
|
|
|
|
2015-07-03 17:54:14 +00:00
|
|
|
var OutOfGasError = errors.New("Out of gas")
|
|
|
|
var DepthError = fmt.Errorf("Max call depth exceeded (%d)", params.CallCreateDepth)
|
2014-10-23 12:04:00 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|