Skip to content

Commit

Permalink
Don't crash when replay fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Sep 17, 2023
1 parent 73ef7f8 commit 3bf1df6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/runtime/Evaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,13 +913,15 @@ export default class Evaluator {

// Step until reaching the target step index.
while (this.#stepIndex < destinationStep) {
// If done, then something's broken, since it should always be possible to ... GET BACK TO THE FUTURE (lol)
if (this.isDone())
throw Error(
// If done, then something's broken in the program, since it should always be possible to ... GET BACK TO THE FUTURE (lol)
if (this.isDone()) {
console.error(
`Couldn't get back to the future; step ${destinationStep}/${
this.#stepCount
} unreachable. Fatal defect in Evaluator.`
);
return false;
}

this.step();
}
Expand Down Expand Up @@ -1156,7 +1158,7 @@ export default class Evaluator {
// If we're in play mode, tick all the temporal streams.
if (this.temporalReactions.length > 0)
console.error(
"Hmmm, something is modifying temporal streams outside of the Evaluator's control. Tsk tsk!"
"Something is modifying temporal streams outside of the Evaluator's control. Tsk tsk!"
);
// Tick each one, indirectly filling this.temporalReactions.
for (const stream of this.temporalStreams)
Expand Down

0 comments on commit 3bf1df6

Please sign in to comment.