pub enum PrologError {
Instantiation {
context: String,
},
Type {
expected_type: &'static str,
culprit: Term,
context: String,
},
Existence {
object_type: &'static str,
culprit: Term,
context: String,
},
Domain {
expected_domain: &'static str,
culprit: Term,
context: String,
},
Evaluation {
kind: &'static str,
context: String,
},
Permission {
operation: &'static str,
permission_type: &'static str,
culprit: Term,
context: String,
},
Representation {
flag: &'static str,
context: String,
},
Resource {
kind: &'static str,
context: String,
},
Syntax {
context: String,
},
}Expand description
ISO formal-error vocabulary.
Variants§
Instantiation
An argument that must be bound was unbound.
Type
An argument has the wrong type. expected_type is an atom name
(e.g. “integer”, “atom”, “callable”); culprit is the offending term.
Existence
An object referred to by the goal does not exist.
object_type is e.g. “procedure”; culprit is the indicator.
Domain
An argument is outside the valid domain.
Evaluation
Arithmetic evaluation failed (zero divisor, overflow, etc.).
Permission
Operation not permitted.
Representation
Implementation-defined representation limit exceeded.
Resource
Resource limit exhausted. Note: Resource { kind: "steps", ... } is
the step-limit error and is intentionally uncatchable — see
is_uncatchable.
Syntax
Syntax error during runtime term construction (e.g. number_chars/2).
Implementations§
Source§impl PrologError
impl PrologError
Sourcepub fn is_uncatchable(&self) -> bool
pub fn is_uncatchable(&self) -> bool
Step-limit and other safety-ceiling errors must not be catchable by
catch/3 — otherwise a malicious rule could loop indefinitely by
trapping its own timeout. The solver checks this before consulting
the catch stack.
Sourcepub fn to_term(&self, interner: &mut StringInterner) -> Term
pub fn to_term(&self, interner: &mut StringInterner) -> Term
Render as the ISO term error(Formal, Context).
Formal matches the variant (e.g. type_error(integer, foo));
Context is the human-readable atom (the message string interned
as an atom). Test helpers grep this string for substrings.
Sourcepub fn context(&self) -> &str
pub fn context(&self) -> &str
The human-readable context message. This is what test helpers substring-match against and what the CLI shows.
Sourcepub fn to_display(&self, interner: &mut StringInterner) -> String
pub fn to_display(&self, interner: &mut StringInterner) -> String
Render the error term as a human-readable string. Used by the CLI and the test helper for substring assertions.
Trait Implementations§
Source§impl Clone for PrologError
impl Clone for PrologError
Source§fn clone(&self) -> PrologError
fn clone(&self) -> PrologError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more