Online editor: clear errors

This commit is contained in:
Olivier Goffart 2020-10-06 11:50:49 +02:00
parent 1f50e8c85e
commit c9d60d3575
2 changed files with 4 additions and 7 deletions

View file

@ -7,15 +7,10 @@
</head>
<body>
<p>This is a prototype for an online editor for the SixtyFPS language. More info <a
href="https://github.com/sixtyfpsui/sixtyfps">github.com/sixtyfpsui/sixtyfps</a> </p>
<div id="preview" style="max-width: 48%; float: right"></div>
<div id="editor" style="height:600px; width: 48%"></div>
<table style="height: 100%">
<tr>
<td width="50%"></td>
<td></td>
</td>
</table>
</body>
</html>

View file

@ -508,11 +508,13 @@ function render_or_error(source, div) {
canvas.width = 800;
canvas.height = 600;
canvas.id = canvas_id;
div.innerHTML = "";
div.appendChild(canvas);
try {
sixtyfps.instantiate_from_string(source, canvas_id);
} catch (e) {
if (e.message === "Using exceptions for control flow, don't mind me. This isn't actually an error!") {
monaco.editor.setModelMarkers(editor.getModel(), "sixtyfps", []);
throw e;
}
var text = document.createTextNode(e.message);