pub enum NarjuError {
Parse(String),
UnboundVar {
level: usize,
env_len: usize,
},
TypeError {
op: &'static str,
expected: &'static str,
actual: String,
},
Stage(String),
Io(Error),
Throw(Val),
}Expand description
Any error the evaluator or its entry points can produce.
Errors abort the current top-level evaluation and unwind the CK
machine’s continuation stack. Two forms survive in-language: a
NarjuError::Throw raised inside a catch arrives at the catch
site with its payload intact, and any other error inside a catch
arrives stringified via Display. The #[error] strings here are
therefore user-visible surface, both at the REPL and through
catch.
Variants§
Parse(String)
Malformed source, from the reader or from lowering (which reports unbound names at parse time with their surface names).
UnboundVar
A Var index past the end of the runtime environment. Lowering
makes this unreachable from surface source; it can only arise
from hand-built or mis-translated Exp trees, so the message
reports raw indices — there is no name to report.
Fields
TypeError
A primitive applied to a value of the wrong shape.
Fields
Stage(String)
A staging-discipline violation: lifting the unliftable,
running at the wrong level, a malformed trans/evalms
argument, and the like.
Io(Error)
A failure from the underlying I/O implementation
(read, read-file, print).
Throw(Val)
(throw v): a user-raised error carrying a first-class Val
payload. unwind_to_catch unpacks the payload structurally into
(error <payload> ()) instead of stringifying it, so structured
signals like (unbound . name) survive to the catch site.