pub enum RuntimeError {
Show 16 variants
UndefinedVariable(String),
TypeError(String),
TypeErrorDetailed {
expected: String,
got: String,
},
InvalidOperation(String),
DivisionByZero,
NotCallable(String),
WrongArity {
expected: usize,
got: usize,
},
Return(Value),
Yield(Value),
Break,
Continue,
Throw(Value),
ImportError(Box<ImportError>),
WithCallStack {
error: Box<RuntimeError>,
call_stack: Vec<CallFrame>,
},
ExecutionLimit(ExecutionLimitError),
CustomError(String),
}Expand description
Runtime errors
Variants§
UndefinedVariable(String)
Variable not found
TypeError(String)
Type mismatch - simple message
TypeErrorDetailed
Type mismatch - detailed version
InvalidOperation(String)
Invalid operation
DivisionByZero
Division by zero
NotCallable(String)
Function not found or not callable
WrongArity
Wrong number of arguments
Return(Value)
Return statement (used for control flow)
Yield(Value)
Yield statement (used for generators)
Break
Break statement (used for loop control)
Continue
Continue statement (used for loop control)
Throw(Value)
Throw statement (user-thrown error)
ImportError(Box<ImportError>)
Structured Import/Export module errors (with import chain)
WithCallStack
Attach a captured call stack to an error.
ExecutionLimit(ExecutionLimitError)
Execution limit exceeded
CustomError(String)
Custom error message (用于IO操作等)
Implementations§
Source§impl RuntimeError
impl RuntimeError
pub fn to_error_report(&self) -> ErrorReport
Trait Implementations§
Source§impl Clone for RuntimeError
impl Clone for RuntimeError
Source§fn clone(&self) -> RuntimeError
fn clone(&self) -> RuntimeError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RuntimeError
impl Debug for RuntimeError
Source§impl Display for RuntimeError
impl Display for RuntimeError
Source§impl Error for RuntimeError
impl Error for RuntimeError
1.30.0 · 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()
Source§impl PartialEq for RuntimeError
impl PartialEq for RuntimeError
impl StructuralPartialEq for RuntimeError
Auto Trait Implementations§
impl Freeze for RuntimeError
impl !RefUnwindSafe for RuntimeError
impl !Send for RuntimeError
impl !Sync for RuntimeError
impl Unpin for RuntimeError
impl !UnwindSafe for RuntimeError
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