2014-10-23 15:04:00 +03:00
|
|
|
package vm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-06-12 14:35:14 +03:00
|
|
|
|
2015-04-02 06:17:15 +03:00
|
|
|
"github.com/ethereum/go-ethereum/params"
|
2014-10-23 15:04:00 +03:00
|
|
|
)
|
|
|
|
|
2015-06-12 14:35:14 +03:00
|
|
|
type OutOfGasError struct{}
|
2014-10-23 15:04:00 +03:00
|
|
|
|
|
|
|
func (self OutOfGasError) Error() string {
|
2015-06-12 14:35:14 +03:00
|
|
|
return "Out Of Gas"
|
2014-10-23 15:04:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2015-04-02 06:17:15 +03:00
|
|
|
return fmt.Sprintf("Max call depth exceeded (%d)", params.CallCreateDepth)
|
2014-10-23 15:04:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func IsDepthErr(err error) bool {
|
|
|
|
_, ok := err.(DepthError)
|
|
|
|
return ok
|
|
|
|
}
|