error-system #13
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-prolog!13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "error-system"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
● All 11 tasks complete. Summary of what shipped: Error System Implementation — Complete Tests: 320 total (147 unit + 173 integration), up from 290. All green. What's New ISO error vocabulary (crates/patch-prolog-core/src/error.rs): - PrologError enum with all 9 ISO formal-error constructors - ThrownError propagation type with uncatchable flag - format_term public helper for rendering ISO error terms as strings Catch/throw: - throw/1 — raises a term that propagates through the solver - catch/3 — pushes a catch-barrier choice point; dispatch_or_return walks the choice stack on errors, unwinds to a matching catcher, runs recovery - Cut is opaque to catch — ! inside catch's goal can't destroy the catch frame Dynamic predicate directive: - :- dynamic(F/A). (single or comma-list) parsed into ProgramDirectives - CompiledDatabase carries the dynamic set, serialized via bincode - Undefined non-dynamic predicates throw existence_error(procedure, F/A); dynamic ones fail silently (linter contract preserved) Architectural cleanup: - SolveResult::Error(String) → Error(Term) - try_solve_once / try_solve_collecting now return Result<bool, ThrownError> - try_exec_misc returns Result<Option<bool>, ThrownError> - steps_exceeded side-channel flag eliminated — step limit flows through ThrownError { uncatchable: true } - All ~60 built-in error sites in solver.rs and builtins.rs migrated from String to structured PrologError Safety: - Step limit (resource_error(steps)) is uncatchable - CLI renders error terms via format_term for both JSON and text output Files Changed - New: crates/patch-prolog-core/src/error.rs - Updated: parser.rs (directive parsing), database.rs (dynamic set + indexing helper), solver.rs (Result refactor, catch/throw), builtins.rs (PrologError-typed errors, throw/catch dispatch), lib.rs (exports) - CLI template (src/compiler.rs): error rendering via format_term - knowledge/rules.pl: added :- dynamic(field/1). - Docs: ARCHITECTURE.md, ROADMAP.md, README.md, docs/design/{SOLVER,SAFETY,ISO_COMPLIANCE,ERROR_SYSTEM}.md - Tests: 16 new throw/catch/error-shape tests in tests/integration.rs, plus updates to existing tests for the new undefined-predicate semantics