Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/sample-app-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ const runCode = () => {

if (outputDiv) outputDiv.innerHTML = '';

eval(code);
// Wrap `eval` in a `try/catch` so that any runtime errors are
// logged to the console, instead of failing quietly.
try {
eval(code);
} catch (error) {
console.log(error);
}
};

if (ws) {
Expand Down
8 changes: 7 additions & 1 deletion examples/sample-app/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ const runCode = () => {

outputDiv.innerHTML = '';

eval(code);
// Wrap `eval` in a `try/catch` so that any runtime errors are
// logged to the console, instead of failing quietly.
try {
eval(code);
} catch (error) {
console.log(error);
}
};

// Load the initial state from storage and run the code.
Expand Down
Loading