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> </head>
<body> <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="preview" style="max-width: 48%; float: right"></div>
<div id="editor" style="height:600px; width: 48%"></div> <div id="editor" style="height:600px; width: 48%"></div>
<table style="height: 100%">
<tr>
<td width="50%"></td>
<td></td>
</td>
</table>
</body> </body>
</html> </html>

View file

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