error checking on Hank story window
This commit is contained in:
@@ -1146,10 +1146,15 @@
|
||||
(window.show)))
|
||||
|
||||
(function hankStoryWindow [:String file :ConstructorArgs args &opt :Map<String,HankChoiceTagEvent> 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)
|
||||
}))))
|
||||
|
||||
Reference in New Issue
Block a user