diff options
Diffstat (limited to 'object')
| -rw-r--r-- | object/object.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/object/object.go b/object/object.go index fbecf88..20deb0c 100644 --- a/object/object.go +++ b/object/object.go @@ -9,6 +9,7 @@ const ( BOOLEAN_OBJ = "BOOLEAN" NULL_OBJ = "NULL" RETURN_VALUE_OBJ = "RETURN_VALUE" + ERROR_OBJ = "ERROR" ) type Object interface { @@ -30,6 +31,10 @@ type ReturnValue struct { Value Object } +type Error struct { + Message string +} + func (i *Integer) Type() ObjectType { return INTEGER_OBJ } @@ -61,3 +66,6 @@ func (rv *ReturnValue) Type() ObjectType { func (rv *ReturnValue) Inspect() string { return rv.Value.Inspect() } + +func (e *Error) Type() ObjectType { return ERROR_OBJ } +func (e *Error) Inspect() string { return "ERROR:" + e.Message } |
