pub enum FaultKind {
Show 13 variants
StackOverflow,
StackUnderflow,
InvalidVariableIndex,
InvalidArgumentIndex,
InvalidVtableIndex,
UnknownFunction {
kind: ValueKind,
name: Symbol,
},
TypeMismatch {
message: String,
expected: ValueKind,
received: Value,
},
InvalidType {
message: String,
received: Value,
},
Dynamic(DynamicFault),
ArgumentMissing(Symbol),
TooManyArguments(Value),
ValueCannotBeHashed(Value),
ValueOutOfRange(&'static str),
}
Expand description
An unexpected event within the virtual machine.
Variants§
StackOverflow
An attempt to push a value to the stack was made after the stack has reached its capacity.
StackUnderflow
An attempt to pop a value off of the stack was made when no values were present in the current code’s stack frame.
InvalidVariableIndex
An invalid variable index was used.
InvalidArgumentIndex
An invalid argument index was used.
InvalidVtableIndex
An invalid vtable index was used.
UnknownFunction
Fields
A call was made to a function that does not exist.
TypeMismatch
Fields
A value type was unexpected in the given context.
InvalidType
Fields
An invalid value type was encountered.
Dynamic(DynamicFault)
An error arose from dynamic types.
ArgumentMissing(Symbol)
An argument that was expected to a function was not passed.
TooManyArguments(Value)
Too many arguments were passed to a function.
ValueCannotBeHashed(Value)
A value that does not support hashing was used as a key in a hash map.
ValueOutOfRange(&'static str)
A value was encountered that was out of range of valid values.
Implementations§
source§impl FaultKind
impl FaultKind
sourcepub fn invalid_type(message: impl Into<String>, received: Value) -> Self
pub fn invalid_type(message: impl Into<String>, received: Value) -> Self
An invalid type was encountered.
These patterns will be replaced in message
before being Displayed:
- @received-value
- @received-kind
sourcepub fn type_mismatch(
message: impl Into<String>,
expected: ValueKind,
received: Value
) -> Self
pub fn type_mismatch( message: impl Into<String>, expected: ValueKind, received: Value ) -> Self
An type mismatch occurred.
These patterns will be replaced in message
before being Displayed:
- @expected
- @received-value
- @received-kind
sourcepub fn dynamic<T: Debug + Display + 'static>(fault: T) -> Self
pub fn dynamic<T: Debug + Display + 'static>(fault: T) -> Self
Returns a FaultKind::Dynamic
.