pub enum EvalErrorRe {
UnboundSymbol {
name: Arc<str>,
at: Span,
},
ArityMismatch {
fn_name: Arc<str>,
expected: Arity,
got: usize,
at: Span,
},
TypeMismatch {
expected: &'static str,
got: &'static str,
at: Span,
},
DivisionByZero {
at: Span,
},
NotCallable {
value_kind: &'static str,
at: Span,
},
BadSpecialForm {
form: Arc<str>,
reason: String,
at: Span,
},
NativeFn {
name: Arc<str>,
reason: String,
at: Span,
},
Reader(LispError),
Halted,
NotImplemented(&'static str),
User {
value: Value,
at: Span,
},
}Variants§
UnboundSymbol
ArityMismatch
TypeMismatch
DivisionByZero
NotCallable
BadSpecialForm
NativeFn
Reader(LispError)
Halted
NotImplemented(&'static str)
User
A Lisp-side error raised via (throw ...). Caught by
(try ... (catch (e) ...)). The carried Value is whatever
the user threw — conventionally a Value::Error produced by
(error ...) / (ex-info ...), but any Value is allowed.
Implementations§
Source§impl EvalError
impl EvalError
pub fn unbound(name: impl Into<Arc<str>>, at: Span) -> EvalError
pub fn type_mismatch( expected: &'static str, got: &'static str, at: Span, ) -> EvalError
pub fn native_fn( name: impl Into<Arc<str>>, reason: impl Into<String>, at: Span, ) -> EvalError
pub fn bad_form( form: impl Into<Arc<str>>, reason: impl Into<String>, at: Span, ) -> EvalError
Sourcepub fn render(&self, src: &str) -> String
pub fn render(&self, src: &str) -> String
Render this error with source context — finds the line containing
the error’s span in src, prints that line, and underlines the
span with ^ markers. Produces a multi-line string suitable for
CLI / REPL output.
If the error has no span, or its span is synthetic, renders just the error message without source context.
Sourcepub fn short_message(&self) -> String
pub fn short_message(&self) -> String
Short, one-line summary of the error kind — no source context.
Trait Implementations§
Source§impl Error for EvalError
impl Error for EvalError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for EvalError
impl !RefUnwindSafe for EvalError
impl Send for EvalError
impl Sync for EvalError
impl Unpin for EvalError
impl UnsafeUnpin for EvalError
impl !UnwindSafe for EvalError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more