Files
monkey/internal/object/error.go
csmith 99f7553d67
Some checks failed
Publish Image / publish (push) Waiting to run
Test / build (push) Waiting to run
Build / build (push) Has been cancelled
refactor objects
2024-04-01 17:34:10 -04:00

29 lines
527 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
}
// Copy implements the Copyable interface
func (e Error) Copy() Object {
return Error{Message: e.Message}
}
func (e Error) String() string {
return e.Message
}