Files
monkey/internal/object/error.go
Charles Smith aebbe43999
Some checks failed
Build / build (push) Successful in 10m25s
Publish Image / publish (push) Failing after 39s
Test / build (push) Successful in 11m19s
Fix VM memory allocation optimizations by reducing what we allocate on the heap
2024-03-31 20:44:50 -04:00

28 lines
486 B
Go

package object
// error encountered. This object is tracked through the evaluator and when
// encountered stops evaluation of the program or body of a function.
type Error struct {
Message string
}
func (e Error) Bool() bool {
return false
}
func (e Error) Type() Type {
return ErrorType
}
func (e Error) Inspect() string {
return "Error: " + e.Message
}
func (e Error) Clone() Object {
return Error{Message: e.Message}
}
func (e Error) String() string {
return e.Message
}