Files
monkey/internal/object/error.go
Chuck Smith 3b6df3e813
Some checks failed
Build / build (push) Failing after 5m54s
Publish Image / publish (push) Failing after 44s
Test / build (push) Failing after 5m21s
Refactor VM and operators
2024-03-29 17:59:34 -04:00

28 lines
492 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
}