summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
be095be)
By sending them to the clients and having them render it in red
monospace with pre-wrapped whitespace.
This should allow the players to debug things when they don't work.
+ #error {
+ font-family: monospace;
+ color: red;
+ white-space: pre-wrap;
+ }
<textarea id="code" rows="15" width="100%"></textarea>
<button type="submit">Run code</button>
</form>
<textarea id="code" rows="15" width="100%"></textarea>
<button type="submit">Run code</button>
</form>
+ <div id="error">
+ </div>
<button id="jumpstart">
Jumpstart Magic School Bus
<button id="jumpstart">
Jumpstart Magic School Bus
const welcome_message = document.getElementById("welcome-message");
const jumpstart = document.getElementById("jumpstart");
const output = document.getElementById("output");
const welcome_message = document.getElementById("welcome-message");
const jumpstart = document.getElementById("jumpstart");
const output = document.getElementById("output");
+ const error = document.getElementById("error");
function fade_element(elt) {
elt.style.opacity = "100%";
function fade_element(elt) {
elt.style.opacity = "100%";
+ socket.on('error', (error_message) => {
+ error.textContent = error_message;
+ });
+
socket.on('state', (state) => {
if (state === "program") {
welcome.style.visibility = "hidden";
socket.on('state', (state) => {
if (state === "program") {
welcome.style.visibility = "hidden";
});
socket.on('output', (filename) => {
});
socket.on('output', (filename) => {
+ error.textContent = "";
output.src = filename;
});
output.src = filename;
});
// Give all clients the new image
io_bus.emit('output', filename);
} catch (e) {
// Give all clients the new image
io_bus.emit('output', filename);
} catch (e) {
- console.log("Error executing turtle script: " + e);
+ // Send any error out to the users
+ io_bus.emit('error', e.toString())