Print error message when exit with status 1.
@@ -3,6 +3,7 @@ package vm
import (
"os"
"sync"
+ "fmt"
)
type stack struct {
@@ -17,12 +18,13 @@ type stack struct {
func (s *stack) set(index int, pointer *Pointer) {
t := s.thread
- if _, ok := pointer.Target.(*Error); ok {
+ if err, ok := pointer.Target.(*Error); ok {
cf := t.callFrameStack.top()
cf.pc = len(cf.instructionSet.instructions)
if t.vm.mode == NormalMode {
if t.isMainThread() {
+ fmt.Println(err.Message)
os.Exit(1)
}
}
@@ -45,13 +47,14 @@ func (s *stack) push(v *Pointer) {
s.Data[s.thread.sp] = v
}
- if _, ok := v.Target.(*Error); ok {
+ if err, ok := v.Target.(*Error); ok {
t := s.thread
cf := t.callFrameStack.top()
cf.pc = len(cf.instructionSet.instructions)
if t.vm.mode == NormalMode {
if t.isMainThread() {
+ fmt.Println(err.Message)
os.Exit(1)
}
}
