Skip to main content

RunError

Enum RunError 

Source
pub enum RunError {
    Parse(String),
    Types(Vec<String>),
    Lower(String),
    Eval(String),
    Import(String),
}
Expand description

Why a run stopped short.

Variants§

§

Parse(String)

§

Types(Vec<String>)

The type checker rejected the program. Carries every diagnostic, not just the first: a caller fixing one error wants to see the rest.

Each one is already rendered file:line:col: message against the file the offending form came from — which, in a program with imports, is frequently not the file the user named. The rendering happens here rather than at the consumer because here is where the file table exists; see uses::ResolvedProgram::locate.

§

Lower(String)

No longer reachable, and that is the point. This reported “blue emitted a tree the reader could not read back” — a failure only a print-then-reparse hop could have. crate::lower_to_spanned deleted the hop, so there is nothing left to fail: the tree the evaluator gets IS the tree erasure produced, not a re-reading of its text.

Kept rather than removed because it is public API on a released crate and a consumer may still match on it, per ★★ MODULARIZE, DON’T DELETE. It is retired, not orphaned — if a future stage ever serialises again it has a typed home. Nothing constructs it today; do not read its presence as evidence the pipeline can still fail this way.

§

Eval(String)

The program ran and raised.

Rendered file:line:col: message against the file the failing form’s top-level form came from — the same uses::ResolvedProgram::locate machinery, the same file table and the same join key the type errors above use. Until erasure learned to carry spans this was a bare message, because the evaluator was handed a tree whose every node had been stamped Span::synthetic() on the way in.

The honest limit, stated so nobody reads more into a position than is there. The index names the top-level form that was EXECUTING; the span names where the failing text SITS. Those agree on the file whenever the failing code is in the same file as the top-level form that reached it — which is every single-file program, and an imported package whose own top-level code raises. They can disagree when a top-level form in file A calls a function defined in file B and the raise happens inside B: the path reported is A’s. locate refuses to print a line:col it cannot justify (the span must be a real range in that file), so the usual shape of that case is a file with no position rather than a precise-looking wrong one — but a same-length pair of files can still put a plausible number on the wrong file. Closing it needs per-frame file identity at the evaluator, which is a call stack blue does not have.

§

Import(String)

A use("name") could not be resolved.

Its own variant rather than folded into Parse, because the reader’s next action is different: a parse error is in the source in front of them, an import error is in their packaging — a missing bidama, a BLUE_PATH that does not contain it, or no loader at all.

Trait Implementations§

Source§

impl Debug for RunError

Source§

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

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

impl Display for RunError

Source§

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

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

impl Error for RunError

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

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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.