errors.go 519 B

12345678910111213141516171819202122232425262728
  1. package vm
  2. import (
  3. "errors"
  4. "fmt"
  5. "github.com/ethereum/go-ethereum/params"
  6. )
  7. var OutOfGasError = errors.New("Out of gas")
  8. var DepthError = fmt.Errorf("Max call depth exceeded (%d)", params.CallCreateDepth)
  9. type StackError struct {
  10. req, has int
  11. }
  12. func StackErr(req, has int) StackError {
  13. return StackError{req, has}
  14. }
  15. func (self StackError) Error() string {
  16. return fmt.Sprintf("stack error! require %v, have %v", self.req, self.has)
  17. }
  18. func IsStack(err error) bool {
  19. _, ok := err.(StackError)
  20. return ok
  21. }