#[non_exhaustive]
pub enum EvalAltResult {
Show 32 variants ErrorSystem(StringBox<dyn Error>), ErrorParsing(ParseErrorTypePosition), ErrorVariableExists(StringPosition), ErrorForbiddenVariable(StringPosition), ErrorVariableNotFound(StringPosition), ErrorPropertyNotFound(StringPosition), ErrorIndexNotFound(DynamicPosition), ErrorFunctionNotFound(StringPosition), ErrorModuleNotFound(StringPosition), ErrorInFunctionCall(StringStringBox<Self>, Position), ErrorInModule(StringBox<Self>, Position), ErrorUnboundThis(Position), ErrorMismatchDataType(StringStringPosition), ErrorMismatchOutputType(StringStringPosition), ErrorIndexingType(StringPosition), ErrorArrayBounds(usizeINTPosition), ErrorStringBounds(usizeINTPosition), ErrorBitFieldBounds(usizeINTPosition), ErrorFor(Position), ErrorDataRace(StringPosition), ErrorAssignmentToConstant(StringPosition), ErrorDotExpr(StringPosition), ErrorArithmetic(StringPosition), ErrorTooManyOperations(Position), ErrorTooManyModules(Position), ErrorStackOverflow(Position), ErrorDataTooLarge(StringPosition), ErrorTerminated(DynamicPosition), ErrorCustomSyntax(StringVec<String>, Position), ErrorRuntime(DynamicPosition), LoopBreak(boolPosition), Return(DynamicPosition),
}
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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

ErrorSystem(StringBox<dyn Error>)

System error. Wrapped values are the error message and the internal error.

ErrorParsing(ParseErrorTypePosition)

Syntax error.

ErrorVariableExists(StringPosition)

Shadowing of an existing variable disallowed. Wrapped value is the variable name.

ErrorForbiddenVariable(StringPosition)

Forbidden variable name. Wrapped value is the variable name.

ErrorVariableNotFound(StringPosition)

Access of an unknown variable. Wrapped value is the variable name.

ErrorPropertyNotFound(StringPosition)

Access of an unknown object map property. Wrapped value is the property name.

ErrorIndexNotFound(DynamicPosition)

Access of an invalid index. Wrapped value is the index name.

ErrorFunctionNotFound(StringPosition)

Call to an unknown function. Wrapped value is the function signature.

ErrorModuleNotFound(StringPosition)

Usage of an unknown module. Wrapped value is the module name.

ErrorInFunctionCall(StringStringBox<Self>, Position)

An error has occurred inside a called function. Wrapped values are the function name, function source, and the interior error.

ErrorInModule(StringBox<Self>, 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(StringStringPosition)

Data is not of the required type. Wrapped values are the type requested and type of the actual result.

ErrorMismatchOutputType(StringStringPosition)

Returned type is not the same as the required output type. Wrapped values are the type requested and type of the actual result.

ErrorIndexingType(StringPosition)

Trying to index into a type that has no indexer function defined. Wrapped value is the type name.

ErrorArrayBounds(usizeINTPosition)

Array access out-of-bounds. Wrapped values are the current number of elements in the array and the index number.

ErrorStringBounds(usizeINTPosition)

String indexing out-of-bounds. Wrapped values are the current number of characters in the string and the index number.

ErrorBitFieldBounds(usizeINTPosition)

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(StringPosition)

Data race detected when accessing a variable. Wrapped value is the variable name.

ErrorAssignmentToConstant(StringPosition)

Assignment to a constant variable. Wrapped value is the variable name.

ErrorDotExpr(StringPosition)

Inappropriate property access. Wrapped value is the property name.

ErrorArithmetic(StringPosition)

Arithmetic error encountered. Wrapped value is the error message.

ErrorTooManyOperations(Position)

Number of operations over maximum limit.

ErrorTooManyModules(Position)

Modules over maximum limit.

ErrorStackOverflow(Position)

Call stack over maximum limit.

ErrorDataTooLarge(StringPosition)

Data value over maximum size limit. Wrapped value is the type name.

ErrorTerminated(DynamicPosition)

The script is prematurely terminated. Wrapped value is the termination token.

ErrorCustomSyntax(StringVec<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(DynamicPosition)

Run-time error encountered. Wrapped value is the error token.

LoopBreak(boolPosition)

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(DynamicPosition)

Not an error: Value returned from a script via the return keyword. Wrapped value is the result value.

Implementations

Is this a pseudo error? A pseudo error is one that does not occur naturally.

LoopBreak and Return are pseudo errors.

Can this error be caught?

Is this error a system exception?

Unwrap this error and get the very base error.

Get the position of this error.

Remove the position information from this error.

The position of this error is set to NONE afterwards.

Remove the position information from this error and return it.

The position of this error is set to NONE afterwards.

Override the position of this error.

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Raised when there is general error when deserializing a type. Read more
Raised when a Deserialize receives a type different from what it was expecting. Read more
Raised when a Deserialize receives a value of the right type but that is wrong for some other reason. Read more
Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
Raised when a Deserialize enum type received a variant with an unrecognized name. Read more
Raised when a Deserialize struct type received a field with an unrecognized name. Read more
Raised when a Deserialize struct type expected to receive a required field with a particular name but that field was not present in the input. Read more
Raised when a Deserialize struct type received more than one of the same field. Read more
Used when a Serialize implementation encounters any error while serializing a type. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0:

use the Display impl or to_string()

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.