sketch-sh
sketch-sh copied to clipboard
Continue evaluating other codeblocks even if a fatal error was thrown
In education sketches like this one, the author sometimes wants to explicitly throw an error
and continue to explain the idea below. Maybe we should continue evaluating other codeblocks?
another example in the wild:

Maybe it's worth adding a "skip" option for code blocks? It could be something that only shows up when a block fails to evaluate.
@hcarty I see. That's an interesting idea. I'll explore that route to see how complicated it's to implement
- octachron on Discord:
For a similar purpose, the manual example generator uses an attribute when a error is expected (
[@expect error])
Let's go with the approach of adding an option to the block to say that this block is expecting to fail. And probably we should only display the option when there is an error.
Details:
- This is the condition in worker thread https://github.com/Sketch-sh/sketch-sh/blob/fd75d692784bb21a55575eb94343b8928fcddfba/client/src_analyzer/Worker_Analyze.re#L103-L104 to stop executing when there is an error. We can easily add an option there to keep evaluating other blocks.
- This is where the the code blocks is gathered and send to worker thread https://github.com/Sketch-sh/sketch-sh/blob/fd75d692784bb21a55575eb94343b8928fcddfba/client/src_editor/Editor_Blocks.re#L241-L255
You can put the expect to fail condition there before sending to worker
