pub struct EvalError(/* private fields */);Expand description
An evaluation error: its class, TLC’s code and message, and the node it was raised at.
Implementations§
Source§impl EvalError
impl EvalError
Sourcepub fn general(message: impl Into<String>) -> Self
pub fn general(message: impl Into<String>) -> Self
A GENERAL evaluation error with TLC’s message, as Assert.fail(msg)
raises it.
Sourcepub fn coded(ec: Ec, message: impl Into<String>) -> Self
pub fn coded(ec: Ec, message: impl Into<String>) -> Self
An evaluation error with a specific code, as Assert.fail(EC, params)
raises it (a TLCRuntimeException).
Sourcepub fn eval_exception(ec: Ec, message: impl Into<String>) -> Self
pub fn eval_exception(ec: Ec, message: impl Into<String>) -> Self
An evaluation error raised by a module as an EvalException: a Java
override passes it through unwrapped.
Sourcepub fn exception_kind(&self) -> Option<ExceptionKind>
pub fn exception_kind(&self) -> Option<ExceptionKind>
Observed constructor provenance. Unclassified value-method errors have no such authority, even if their code or message resembles a tool error.
Sourcepub fn value_method(&self) -> Option<ValueMethodFailure>
pub fn value_method(&self) -> Option<ValueMethodFailure>
The actual value-method catch, independent of numeric codes or text.
Sourcepub fn override_cause(&self) -> Option<(StdOp, Ec)>
pub fn override_cause(&self) -> Option<(StdOp, Ec)>
The original operator and error code retained by native wrapping.
An error made with Self::coded has no such provenance, even when
its message contains the same method text and nested tool frames.
use dive_eval::{Ec, EvalError};
let error = EvalError::coded(Ec::JavaMethodOverride, "nested tool text");
assert_eq!(error.override_cause(), None);Sourcepub fn unsupported(feature: impl Into<String>) -> Self
pub fn unsupported(feature: impl Into<String>) -> Self
An explicit refusal: dive does not implement feature exactly.
Sourcepub fn analysis_only() -> Self
pub fn analysis_only() -> Self
The refusal raised when evaluation forces a static-analysis binder,
which has no runtime value. See Self::is_analysis_only.
Sourcepub fn is_analysis_only(&self) -> bool
pub fn is_analysis_only(&self) -> bool
Whether this is the Self::analysis_only refusal: the evaluated
expression depends on a static-analysis binder. Planners use it to
keep such an argument lazy instead of freezing a value.
Sourcepub fn interrupted(interruption: Interrupted) -> Self
pub fn interrupted(interruption: Interrupted) -> Self
Cooperative host control flow. The driver retains the stop evidence.
Sourcepub fn interruption(&self) -> Option<Interrupted>
pub fn interruption(&self) -> Option<Interrupted>
The typed host interruption, including its opaque driver identity.
Sourcepub fn resource_limit(message: impl Into<String>) -> Self
pub fn resource_limit(message: impl Into<String>) -> Self
A resource limit.
Sourcepub fn bug(message: impl Into<String>) -> Self
pub fn bug(message: impl Into<String>) -> Self
An internal error (a bug in dive), with enough context to reproduce it.
Sourcepub fn at(self, origin: ExprId) -> Self
pub fn at(self, origin: ExprId) -> Self
Attaches the node the error was raised at, unless one is already set.
Sourcepub fn class(&self) -> ErrorClass
pub fn class(&self) -> ErrorClass
The class.
Sourcepub fn ec(&self) -> Ec
pub fn ec(&self) -> Ec
TLC’s error code (meaningful for ErrorClass::Eval).
Sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
The message: TLC’s text for an evaluation error, the feature for a refusal.
Sourcepub fn is_eval_exception(&self) -> bool
pub fn is_eval_exception(&self) -> bool
Whether TLC raises this error as an EvalException rather than as a
TLCRuntimeException (Assert.fail). Some of TLC’s messages depend
on it (SpecProcessor.processConstantDefns).
Trait Implementations§
impl Eq for EvalError
Source§impl Error for EvalError
impl Error for EvalError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()