[dingus] More legible errors

This commit is contained in:
John Doty 2024-10-28 06:01:27 -07:00
parent 7206298cd1
commit 2828d13e3a

View file

@ -88,7 +88,7 @@ function render_state(state, input_editor) {
}
if (state.output_mode === "errors") {
const error_node = document.createElement("pre");
const error_node = document.createElement("div");
error_node.classList.add("error-panel");
if (state.errors.length == 0) {
if (state.tree) {
@ -97,7 +97,13 @@ function render_state(state, input_editor) {
error_node.innerText = "No errors.";
}
} else {
error_node.innerText = state.errors.join("\n");
const ul = document.createElement("ul");
ul.replaceChildren(...state.errors.map(e => {
const li = document.createElement("li");
li.innerText = e;
return li;
}));
error_node.appendChild(ul);
}
OUTPUT.replaceChildren(error_node);