From: Tim Vaughan Date: Thu, 28 Sep 2017 22:15:24 +0000 (+0200) Subject: Improved error reporting. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=2cda7c0f280f83e34d3404817224d8bc70812b3e;p=forth.jl.git Improved error reporting. --- diff --git a/src/forth.jl b/src/forth.jl index 4c81dc3..3882a53 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -677,6 +677,10 @@ READ_LINE_CFA = defPrimWord("READ-LINE", () -> begin maxSize = popPS() addr = popPS() + if !(fid in keys(openFiles)) + error(string("Invalid FID ", fid, ".")) + end + fh = openFiles[fid] line = readline(fh, chomp=false) @@ -1336,6 +1340,7 @@ function run(fileName=nothing; initialize=true) jmp = callPrim(jmp) catch ex + println(string("Error in primitive '", getPrimName(jmp), "' at address ", jmp)) showerror(STDOUT, ex) println()