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) }))))