From a7e877eb25f45be3471eef07a7b4b090b84c9434 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 11 Nov 2025 15:32:40 -0600 Subject: [PATCH] error checking on Hank story window --- src/kiss_flixel/SimpleWindow.kiss | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/kiss_flixel/SimpleWindow.kiss b/src/kiss_flixel/SimpleWindow.kiss index f73c21d..aa1d0da 100644 --- a/src/kiss_flixel/SimpleWindow.kiss +++ b/src/kiss_flixel/SimpleWindow.kiss @@ -1146,10 +1146,15 @@ (window.show))) (function hankStoryWindow [:String file :ConstructorArgs args &opt :Map onChoiceTags] - (let [story (Story.FromFile file) + (whenLet [story (try (Story.FromFile file) + (catch [e] (return (notify "Failed to parse story from $file: $e" ->:Void {})))) window (SimpleWindow.create args)] (localFunction :Void showNextFrame [] - (let [frame (story.nextFrame)] + (let [frame (try (story.nextFrame) + (catch [e] + (window.hide) + (notify "Hank runtime error: $e" ->:Void {}) + (return)))] (case frame (Finished (window.makeTextV2 "Done" @@ -1167,7 +1172,10 @@ (doFor tag (nth tags idx) (when (onChoiceTags?.exists tag) ((dictGet onChoiceTags tag) choice))) - (story.choose idx) + (try (story.choose idx) + (catch [e] + (window.hide) + (notify "Hank runtime error: $e" ->:Void {}) )) (window.clearControls) (showNextFrame) }))))