Expand description
ISO Prolog error terms.
Built-ins and the solver construct PrologError values when something goes
wrong. Each variant maps 1:1 to an ISO 13211-1 §7.12 formal error term;
to_term renders the value as error(Formal, Context) so user-level
catch/3 recovery clauses can pattern-match against the structured term.
Construction is cheap — no allocation on the success path. The optional
context string lives in the second argument of error/2 and is the
human-readable message format-style; existing tests grep for substrings
in this field, so it’s where helpful detail goes.
Ported from patch-prolog’s error.rs; the only change is sourcing
Term / StringInterner from plg_shared instead of the old in-crate
term module.
Structs§
- Thrown
Error - A thrown error as it flows through the solver. The term is what
catch/3pattern-matches against; theuncatchableflag is set for safety-ceiling errors (step limit) so usercatch/3clauses cannot trap them.
Enums§
- Prolog
Error - ISO formal-error vocabulary.
Functions§
- format_
term - Format an arbitrary term as a Prolog-syntax string. Used by the CLI for rendering uncaught error terms. Lives here (not in a general pretty-printer module) because the only consumer is the error path.