From 3bf1df62e004ff47c414f6fd98e4110d7251c916 Mon Sep 17 00:00:00 2001 From: "Amy J. Ko" Date: Sat, 16 Sep 2023 18:29:25 -0700 Subject: [PATCH] Don't crash when replay fails. --- src/runtime/Evaluator.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/runtime/Evaluator.ts b/src/runtime/Evaluator.ts index 5575cdc04..222acef36 100644 --- a/src/runtime/Evaluator.ts +++ b/src/runtime/Evaluator.ts @@ -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(); } @@ -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)