Show compilation failed

This commit is contained in:
Andrew Morris
2022-12-14 10:19:33 +11:00
parent 81eec5fa0d
commit 3697c2cc2c
2 changed files with 11 additions and 1 deletions

View File

@@ -109,6 +109,12 @@ editorEl.innerHTML = "";
});
function handleUpdate() {
vsmEl.textContent = vslib.compile(model.getValue());
try {
vsmEl.textContent = vslib.compile(model.getValue());
vsmEl.classList.remove("error");
} catch (_error) {
vsmEl.textContent = "Compilation failed";
vsmEl.classList.add("error");
}
}
})();

View File

@@ -208,3 +208,7 @@ input[type=text] {
cursor: pointer;
user-select: none;
}
#vsm.error {
background-color: hsla(0, 100%, 50%, 0.05);
}