5.2.8. Error Handling

Todo

Spicy’s error handling remains quite limited at this point, with more to come here in the future.

Exceptions

Exceptions provide Spicy’s primary mechanism for reporting errors. Currently, various parts of the runtime system throw exceptions if they encounter unexpected situations. In particular, the generated parsers throw ParsingError exceptions if they find themselves unable to comprehend their input. However, support for catching and handling exceptions remains minimal at the moment. For now, only ParsingError exceptions can be intercepted (but not suppressed) with %on_error unit hook, which internally is nothing else than a hook into parser teardown on exceptions.

Todo

Support for catching other exception throughs try/catch needs to be added still (#89).

result<T> / error

Todo

Spicy doesn’t have result/error yet (#90).

Error recovery

Support for resynchronizing parser with their input stream after parse errors is discussed in the section on error recovery.