Skip to main content

EvalError

Struct EvalError 

Source
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

Source

pub fn general(message: impl Into<String>) -> Self

A GENERAL evaluation error with TLC’s message, as Assert.fail(msg) raises it.

Source

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).

Source

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.

Source

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.

Source

pub fn value_method(&self) -> Option<ValueMethodFailure>

The actual value-method catch, independent of numeric codes or text.

Source

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);
Source

pub fn unsupported(feature: impl Into<String>) -> Self

An explicit refusal: dive does not implement feature exactly.

Source

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.

Source

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.

Source

pub fn interrupted(interruption: Interrupted) -> Self

Cooperative host control flow. The driver retains the stop evidence.

Source

pub fn interruption(&self) -> Option<Interrupted>

The typed host interruption, including its opaque driver identity.

Source

pub fn resource_limit(message: impl Into<String>) -> Self

A resource limit.

Source

pub fn bug(message: impl Into<String>) -> Self

An internal error (a bug in dive), with enough context to reproduce it.

Source

pub fn at(self, origin: ExprId) -> Self

Attaches the node the error was raised at, unless one is already set.

Source

pub fn class(&self) -> ErrorClass

The class.

Source

pub fn ec(&self) -> Ec

TLC’s error code (meaningful for ErrorClass::Eval).

Source

pub fn message(&self) -> &str

The message: TLC’s text for an evaluation error, the feature for a refusal.

Source

pub fn origin(&self) -> Option<ExprId>

The node the error was raised at.

Source

pub fn is_eval(&self) -> bool

Whether this is an evaluation error TLC also raises.

Source

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).

Source

pub fn tool_text(&self) -> String

The error as TLC prints it nested in another -tool message: the bare message for GENERAL, or the message wrapped in its own @!@!@STARTMSG code:0 @!@!@ block.

Trait Implementations§

Source§

impl Clone for EvalError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EvalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for EvalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for EvalError

Source§

impl Error for EvalError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ContextError> for EvalError

Source§

fn from(error: ContextError) -> Self

Converts to this type from the input type.
Source§

impl From<ValueError> for EvalError

Source§

fn from(error: ValueError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for EvalError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EvalError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.