I7 error handling in FyreVM

So within FyreVM I trap a variety of output and correlate this data into a dictionary of name-value pairs or channels.

One of the things I want to do next, and this is likely not a trivial problem, is to identify all error-like default responses and have the output handling work differently than in a standard Glulx engine.

Scenario 1: User attempts an action that is not understood by the parser (we don’t care about the reason at this point).
Standard response: Return error message on Main channel.
Desired response: Return error message on Error channel.

So if you’re familiar with how the online system works, it saves every turn in a database. If I can implement the desired response mechanism, I would change this in one small way. If the engine detects an Error message, it will not store that turn’s data. It will return the channel data, including the error message, which the UI will display in its own fashion (likely a balloon above the command line). The main output will not change from the previous turn, allowing the player to review their situation and try again, without any confusion.

The caveat here is that the author may want to use this scenario as well. This is perfectly acceptable The author can use the error channel anytime they want, and the same UI response will occur. The turn will not be saved, but an important message will be relayed to the player about game play. It’s almost like a META response, but more like game education response. We can use this to train the player.

The question is…what might be the best way to handle this within Inform 7?

Your thoughts are appreciated…

David C.

I figured it out.

I created an extension to handle all of the parser errors by rule…and returned a json object with an error code and message. The back-end turn manager does not save the turn if there is an error.

David C.