From 125a4ed86b6c2047253d8f107d3c95af5d528025 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 25 Oct 2020 22:43:11 -0400 Subject: Format errors in REPL based on source --- docs/repl.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'docs/repl.js') diff --git a/docs/repl.js b/docs/repl.js index 05f870a9..14927537 100644 --- a/docs/repl.js +++ b/docs/repl.js @@ -14,9 +14,12 @@ let repl = ()=>{ try { doc.rslt.textContent=fmt(bqn(s)); } catch(e) { - //if (console&&console.error) console.error(e.stack); + let s=e.src, w=e.message, i=-1; + if (s==="Compiler"&&w.sh[0]===2) [i,w]=w; + if (s==="!") w=w?fmt(w).replace(/^/gm,'! '):'! Error'; + else w=w.sh?w.join(""):w; doc.rslt.classList.add('err'); - doc.rslt.textContent=e.message||'Error'; + doc.rslt.textContent=w; } }, 0); } -- cgit v1.2.3