Added (error)
authorTim Vaughan <tgvaughan@gmail.com>
Fri, 4 Nov 2016 23:51:46 +0000 (12:51 +1300)
committerTim Vaughan <tgvaughan@gmail.com>
Fri, 4 Nov 2016 23:51:46 +0000 (12:51 +1300)
scheme-primitives.4th
scheme.4th

index b71b98d..fdb28d3 100644 (file)
@@ -440,3 +440,19 @@ defer display
     
     apply
 ; make-primitive apply 
+
+( ==== Error System ==== )
+
+:noname ( args -- result )
+    bold fg red
+
+    nil? if
+        ." Error."
+    else
+        ." Error: " car display
+    then
+
+    reset-term
+
+    recoverable-exception throw
+; make-primitive error
index f2d7375..bacd8e0 100644 (file)
@@ -52,7 +52,7 @@ variable nextexception
 make-exception recoverable-exception
 make-exception unrecoverable-exception
 
-: display-warning ( addr count -- )
+: display-exception-msg ( addr count -- )
     bold fg red
     ." Exception: "
     type
@@ -65,7 +65,7 @@ make-exception unrecoverable-exception
 
     [compile] if
         ['] -rot ,
-        ['] display-warning ,
+        ['] display-exception-msg ,
     [compile] then
 
     ['] throw ,
@@ -1709,11 +1709,7 @@ variable gc-stack-depth
             recoverable-exception of false endof
             unrecoverable-exception of true endof
 
-            \ Rethrow anything else:
-            throw
-
-            \ If we're still here, loop again
-            false
+            throw false
         endcase
     until
 ;