Enum EvalAltResult
#[non_exhaustive]pub enum EvalAltResult {
Show 35 variants
ErrorSystem(String, Box<dyn Error + Send + Sync>),
ErrorParsing(ParseErrorType, Position),
ErrorVariableExists(String, Position),
ErrorForbiddenVariable(String, Position),
ErrorVariableNotFound(String, Position),
ErrorPropertyNotFound(String, Position),
ErrorIndexNotFound(Dynamic, Position),
ErrorFunctionNotFound(String, Position),
ErrorModuleNotFound(String, Position),
ErrorInFunctionCall(String, String, Box<EvalAltResult>, Position),
ErrorInModule(String, Box<EvalAltResult>, Position),
ErrorUnboundThis(Position),
ErrorMismatchDataType(String, String, Position),
ErrorMismatchOutputType(String, String, Position),
ErrorIndexingType(String, Position),
ErrorArrayBounds(usize, i32, Position),
ErrorStringBounds(usize, i32, Position),
ErrorBitFieldBounds(usize, i32, Position),
ErrorFor(Position),
ErrorDataRace(String, Position),
ErrorNonPureMethodCallOnConstant(String, Position),
ErrorAssignmentToConstant(String, Position),
ErrorDotExpr(String, Position),
ErrorArithmetic(String, Position),
ErrorTooManyOperations(Position),
ErrorTooManyVariables(Position),
ErrorTooManyModules(Position),
ErrorStackOverflow(Position),
ErrorDataTooLarge(String, Position),
ErrorTerminated(Dynamic, Position),
ErrorCustomSyntax(String, Vec<String>, Position),
ErrorRuntime(Dynamic, Position),
LoopBreak(bool, Dynamic, Position),
Return(Dynamic, Position),
Exit(Dynamic, Position),
}
Expand description
Evaluation result.
All wrapped Position
values represent the location in the script where the error occurs.
Some errors never appear when certain features are turned on. They still exist so that the application can turn features on and off without going through massive code changes to remove/add back enum variants in match statements.
§Thread Safety
Currently, EvalAltResult
is neither Send
nor Sync
.
Turn on the sync
feature to make it Send
+
Sync
.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ErrorSystem(String, Box<dyn Error + Send + Sync>)
System error. Wrapped values are the error message and the internal error.
ErrorParsing(ParseErrorType, Position)
Syntax error.
ErrorVariableExists(String, Position)
Shadowing of an existing variable disallowed. Wrapped value is the variable name.
ErrorForbiddenVariable(String, Position)
Forbidden variable name. Wrapped value is the variable name.
ErrorVariableNotFound(String, Position)
Access of an unknown variable. Wrapped value is the variable name.
ErrorPropertyNotFound(String, Position)
Access of an unknown object map property. Wrapped value is the property name.
ErrorIndexNotFound(Dynamic, Position)
Access of an invalid index. Wrapped value is the index name.
ErrorFunctionNotFound(String, Position)
Call to an unknown function. Wrapped value is the function signature.
ErrorModuleNotFound(String, Position)
ErrorInFunctionCall(String, String, Box<EvalAltResult>, Position)
An error has occurred inside a called function. Wrapped values are the function name, function source, and the interior error.
ErrorInModule(String, Box<EvalAltResult>, Position)
An error has occurred while loading a module. Wrapped value are the module name and the interior error.
ErrorUnboundThis(Position)
Access to this
that is not bound.
ErrorMismatchDataType(String, String, Position)
Data is not of the required type. Wrapped values are the type requested and type of the actual result.
ErrorMismatchOutputType(String, String, Position)
Returned type is not the same as the required output type. Wrapped values are the type requested and type of the actual result.
ErrorIndexingType(String, Position)
Trying to index into a type that has no indexer function defined. Wrapped value is the type name.
ErrorArrayBounds(usize, i32, Position)
Array access out-of-bounds. Wrapped values are the current number of elements in the array and the index number.
ErrorStringBounds(usize, i32, Position)
String indexing out-of-bounds. Wrapped values are the current number of characters in the string and the index number.
ErrorBitFieldBounds(usize, i32, Position)
Bit-field indexing out-of-bounds. Wrapped values are the current number of bits in the bit-field and the index number.
ErrorFor(Position)
The for
statement encounters a type that is not iterable.
ErrorDataRace(String, Position)
Data race detected when accessing a variable. Wrapped value is the variable name.
ErrorNonPureMethodCallOnConstant(String, Position)
Calling a non-pure method on a constant. Wrapped value is the function name.
ErrorAssignmentToConstant(String, Position)
Assignment to a constant variable. Wrapped value is the variable name.
ErrorDotExpr(String, Position)
Inappropriate property access. Wrapped value is the property name.
ErrorArithmetic(String, Position)
Arithmetic error encountered. Wrapped value is the error message.
ErrorTooManyOperations(Position)
Number of operations over maximum limit.
ErrorTooManyVariables(Position)
Number of variables over maximum limit.
ErrorTooManyModules(Position)
Modules over maximum limit.
ErrorStackOverflow(Position)
Call stack over maximum limit.
ErrorDataTooLarge(String, Position)
Data value over maximum size limit. Wrapped value is the type name.
ErrorTerminated(Dynamic, Position)
The script is prematurely terminated. Wrapped value is the termination token.
ErrorCustomSyntax(String, Vec<String>, Position)
Error encountered for a custom syntax. Wrapped values are the error message and custom syntax symbols stream.
Normally this should never happen, unless an AST
is compiled on one
Engine
but evaluated on another unrelated Engine
.
ErrorRuntime(Dynamic, Position)
Run-time error encountered. Wrapped value is the error token.
LoopBreak(bool, Dynamic, Position)
Breaking out of loops - not an error if within a loop.
The wrapped value, if true, means breaking clean out of the loop (i.e. a break
statement).
The wrapped value, if false, means breaking the current context (i.e. a continue
statement).
Return(Dynamic, Position)
Not an error: Value returned from a script via the return
keyword.
Wrapped value is the result value.
Exit(Dynamic, Position)
Not an error: Value returned from a script via the exit
function.
Wrapped value is the exit value.
Implementations§
§impl EvalAltResult
impl EvalAltResult
pub const fn is_pseudo_error(&self) -> bool
pub const fn is_pseudo_error(&self) -> bool
pub const fn is_catchable(&self) -> bool
pub const fn is_catchable(&self) -> bool
Can this error be caught?
pub const fn is_system_exception(&self) -> bool
pub const fn is_system_exception(&self) -> bool
Is this error a system exception?
pub fn unwrap_inner(&self) -> &EvalAltResult
pub fn unwrap_inner(&self) -> &EvalAltResult
Unwrap this error and get the very base error.
pub fn clear_position(&mut self) -> &mut EvalAltResult
pub fn clear_position(&mut self) -> &mut EvalAltResult
pub fn take_position(&mut self) -> Position
pub fn take_position(&mut self) -> Position
pub fn set_position(&mut self, new_position: Position) -> &mut EvalAltResult
pub fn set_position(&mut self, new_position: Position) -> &mut EvalAltResult
Override the position of this error.