Errors
This commit is contained in:
@@ -9,6 +9,7 @@ const (
|
||||
BOOLEAN_OBJ = "BOOLEAN"
|
||||
NULL_OBJ = "NULL"
|
||||
RETURN_VALUE_OBJ = "RETURN_VALUE"
|
||||
ERROR_OBJ = "ERROR"
|
||||
)
|
||||
|
||||
type Object interface {
|
||||
@@ -52,10 +53,22 @@ type ReturnValue struct {
|
||||
Value Object
|
||||
}
|
||||
|
||||
func (rv ReturnValue) Type() ObjectType {
|
||||
func (rv *ReturnValue) Type() ObjectType {
|
||||
return RETURN_VALUE_OBJ
|
||||
}
|
||||
|
||||
func (rv ReturnValue) Inspect() string {
|
||||
func (rv *ReturnValue) Inspect() string {
|
||||
return rv.Value.Inspect()
|
||||
}
|
||||
|
||||
type Error struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e *Error) Type() ObjectType {
|
||||
return ERROR_OBJ
|
||||
}
|
||||
|
||||
func (e *Error) Inspect() string {
|
||||
return "Error: " + e.Message
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user