glicol icon indicating copy to clipboard operation
glicol copied to clipboard

Towards no-panic: the error handling system

Open chaosprint opened this issue 3 years ago • 1 comments

Currently, the pest parser generates an AST, which is actually a HashMap of NodeIndex chains.

The NodeIndex is calculated in the process of parsing.

let node_index = graph.add_node(MyNode::new(paras));

The error handling mechanism is to backup the previously successful code. Once there is an error during the parsing or node creation, backup code will be used.

This brings an issue that if there is an error in the halfway, half of the graph will be modified. And we need to create a new graph (using the old backup code) to replace this half-processed graph. This is really redundant.

Therefore, skipping some middleware like Enum of Glicol nodes is actually missing the big picture.

Such a mechanism should be changed, and perhaps switching to nom parser as the error handling of nom can be more promising.

Update:

  • [ ] Need to make sure when an error is found, everything should run as normal. So far some Message before the error position could have been already sent out.

chaosprint avatar Feb 20 '22 06:02 chaosprint

So far it looks quite stable. But there is some error handling details. For example, when there is an error in the second half of the code, code in the first half will still take effect in some ways, e.g. send an update msg to the sequencer.

chaosprint avatar Apr 03 '22 12:04 chaosprint