diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-12 20:24:29 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-12 20:24:29 -0500 |
| commit | bdc9878f8b1d120aeb2e173e9138ab26da3ca938 (patch) | |
| tree | 07f3740893088f09b6c0f944e0378f4014fade7d | |
| parent | f7f20bab63522e169e464f041f47db45e4a5cfb2 (diff) | |
Fix REPL error reporting for user calls to !
| -rw-r--r-- | docs/bqn.js | 2 | ||||
| -rw-r--r-- | docs/repl.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/docs/bqn.js b/docs/bqn.js index c0f1a4a2..1c522ebd 100644 --- a/docs/bqn.js +++ b/docs/bqn.js @@ -27,7 +27,7 @@ let chkR = v => { if (v===null) throw Error("Runtime: Variable referenced before let genjs = (B, p, L) => { // Bytecode -> Javascript compiler let rD = 0; let r = L?"let l=0;try{":""; - let fin = L?"}catch(e){e.message=[l,e.message];e.message.sh=[2];throw e;}":""; + let fin = L?"}catch(e){e.message=[l,e.message];e.message.loc=true;e.message.sh=[2];throw e;}":""; let szM = 1; let rV = n => { szM=Math.max(szM,n+1); return 'v'+n; }; let rP = val => rV(rD++) + "="+val+";"; diff --git a/docs/repl.js b/docs/repl.js index c45b527c..879acb40 100644 --- a/docs/repl.js +++ b/docs/repl.js @@ -8,7 +8,7 @@ let setcount = !doc.count ? (s=>s) : (s=>{ let setExplain = e=>e; let showErr = (s,e)=>{ let r=e.src, w=e.message, loc=[]; - while (w.sh&&w.sh[0]===2) { + while (w&&w.loc||(r!=='!'&&w.sh&&w.sh[0]===2)) { let is; [is,w]=w; let n=is.sh?is.sh[0]:0, i=n?is[0]:is; let to=i=>s.slice(0,i).join('').split('\n'); |
