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 Error for RunError
impl Error for RunError
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()