bbc-basic: Slight tweak to heap size.
[jackhill/mal.git] / haxe / Step6_file.hx
index f3db8a1..4e7856b 100644 (file)
@@ -1,6 +1,7 @@
 import Compat;
 import types.Types.MalType;
 import types.Types.*;
+import types.MalException;
 import reader.*;
 import printer.*;
 import env.*;
@@ -36,6 +37,7 @@ class Step6_file {
 
         // apply
         var alst = _list(ast);
+        if (alst.length == 0) { return ast; }
 
         switch (alst[0]) {
         case MalSymbol("def!"):
@@ -136,7 +138,11 @@ class Step6_file {
             } catch (exc:haxe.io.Eof) {
                 Compat.exit(0);
             } catch (exc:Dynamic) {
-                Compat.println(exc);
+                if (Type.getClass(exc) == MalException) {
+                    Compat.println("Error: " + Printer.pr_str(exc.obj, true));
+                } else {
+                    Compat.println("Error: " + exc);
+                };
             }
         }
     }