Enum VmError

Source
pub enum VmError {
Show 33 variants Panic { reason: Panic, }, Overflow, Underflow, DivideByZero, UserError { error: Error, }, StackError { error: StackError, }, MissingFunction { hash: Hash, }, MissingModule { module: Hash, }, MissingModuleFunction { module: Hash, hash: Hash, }, IpOutOfBounds, UnsupportedBinaryOperation { op: &'static str, lhs: ValueTypeInfo, rhs: ValueTypeInfo, }, UnsupportedUnaryOperation { op: &'static str, operand: ValueTypeInfo, }, UnsupportedObjectKey { actual: ValueTypeInfo, }, StackOutOfBounds, MissingStaticString { slot: usize, }, MissingStaticObjectKeys { slot: usize, }, StackTopTypeError { expected: ValueTypeInfo, actual: ValueTypeInfo, }, StackConversionError { error: StackError, from: ValueTypeInfo, to: &'static str, }, ArgumentConversionError { error: StackError, arg: usize, from: ValueTypeInfo, to: &'static str, }, ArgumentCountMismatch { actual: usize, expected: usize, }, ReturnConversionError { error: StackError, ret: &'static str, }, UnsupportedIndexSet { target_type: ValueTypeInfo, index_type: ValueTypeInfo, value_type: ValueTypeInfo, }, UnsupportedIndexGet { target_type: ValueTypeInfo, index_type: ValueTypeInfo, }, UnsupportedArrayIndexGet { target_type: ValueTypeInfo, }, UnsupportedObjectSlotIndexGet { target_type: ValueTypeInfo, }, UnsupportedIs { value_type: ValueTypeInfo, test_type: ValueTypeInfo, }, UnsupportedReplaceDeref { target_type: ValueTypeInfo, value_type: ValueTypeInfo, }, UnsupportedDeref { actual_type: ValueTypeInfo, }, MissingType { hash: Hash, }, IllegalPtrReplace { target_ptr: usize, value_ptr: usize, }, UnsupportedCallFn { actual_type: ValueTypeInfo, }, ArrayIndexMissing { index: usize, }, ObjectIndexMissing { slot: usize, },
}
Expand description

Errors raised by the execution of the virtual machine.

Variants§

§

Panic

The virtual machine panicked for no specific reason.

Fields

§reason: Panic

The reason for the panic.

§

Overflow

The virtual machine encountered a numerical overflow.

§

Underflow

The virtual machine encountered a numerical underflow.

§

DivideByZero

The virtual machine encountered a divide-by-zero.

§

UserError

Error raised in a user-defined function.

Fields

§error: Error

Source error.

§

StackError

Failure to interact with the stack.

Fields

§error: StackError

Source error.

§

MissingFunction

Failure to lookup function.

Fields

§hash: Hash

Hash of function to look up.

§

MissingModule

Failure to lookup module.

Fields

§module: Hash

Hash of module to look up.

§

MissingModuleFunction

Failure to lookup function in a module.

Fields

§module: Hash

Module that was looked up.

§hash: Hash

Function that could not be found.

§

IpOutOfBounds

Instruction pointer went out-of-bounds.

§

UnsupportedBinaryOperation

Unsupported binary operation.

Fields

§op: &'static str

Operation.

§lhs: ValueTypeInfo

Left-hand side operator.

§rhs: ValueTypeInfo

Right-hand side operator.

§

UnsupportedUnaryOperation

Unsupported unary operation.

Fields

§op: &'static str

Operation.

§operand: ValueTypeInfo

Operand.

§

UnsupportedObjectKey

Unsupported argument to object-exact-keys.

Fields

§actual: ValueTypeInfo

The encountered argument.

§

StackOutOfBounds

Attempt to access out-of-bounds stack item.

§

MissingStaticString

Indicates that a static string is missing for the given slot.

Fields

§slot: usize

Slot which is missing a static string.

§

MissingStaticObjectKeys

Indicates that a static object keys is missing for the given slot.

Fields

§slot: usize

Slot which is missing a static object keys.

§

StackTopTypeError

Saw an unexpected stack value.

Fields

§expected: ValueTypeInfo

The type that was expected.

§actual: ValueTypeInfo

The type observed.

§

StackConversionError

Indicates a failure to convert from one type to another.

Fields

§error: StackError

The source of the error.

§from: ValueTypeInfo

The actual type to be converted.

§to: &'static str

The expected type to convert towards.

§

ArgumentConversionError

Failure to convert from one type to another.

Fields

§error: StackError

The underlying stack error.

§arg: usize

The argument location that was converted.

§from: ValueTypeInfo

The value type we attempted to convert from.

§to: &'static str

The native type we attempt to convert to.

§

ArgumentCountMismatch

Wrong number of arguments provided in call.

Fields

§actual: usize

The actual number of arguments.

§expected: usize

The expected number of arguments.

§

ReturnConversionError

Failure to convert return value.

Fields

§error: StackError

Error describing the failed conversion.

§ret: &'static str

Type of the return value we attempted to convert.

§

UnsupportedIndexSet

An index set operation that is not supported.

Fields

§target_type: ValueTypeInfo

The target type to set.

§index_type: ValueTypeInfo

The index to set.

§value_type: ValueTypeInfo

The value to set.

§

UnsupportedIndexGet

An index get operation that is not supported.

Fields

§target_type: ValueTypeInfo

The target type to get.

§index_type: ValueTypeInfo

The index to get.

§

UnsupportedArrayIndexGet

An array index get operation that is not supported.

Fields

§target_type: ValueTypeInfo

The target type we tried to perform the array indexing on.

§

UnsupportedObjectSlotIndexGet

An object slot index get operation that is not supported.

Fields

§target_type: ValueTypeInfo

The target type we tried to perform the object indexing on.

§

UnsupportedIs

An is operation is not supported.

Fields

§value_type: ValueTypeInfo

The argument that is not supported.

§test_type: ValueTypeInfo

The type that is not supported.

§

UnsupportedReplaceDeref

Encountered a value that could not be dereferenced.

Fields

§target_type: ValueTypeInfo

The type we try to assign to.

§value_type: ValueTypeInfo

The type we try to assign.

§

UnsupportedDeref

Encountered a value that could not be dereferenced.

Fields

§actual_type: ValueTypeInfo

The type that could not be de-referenced.

§

MissingType

Missing type.

Fields

§hash: Hash

Hash of the type missing.

§

IllegalPtrReplace

Attempting to assign an illegal pointer.

Fields

§target_ptr: usize

The target ptr being assigned to.

§value_ptr: usize

The value ptr we are trying to assign.

§

UnsupportedCallFn

Encountered a value that could not be called as a function

Fields

§actual_type: ValueTypeInfo

The type that could not be called.

§

ArrayIndexMissing

Tried to fetch an index in an array that doesn’t exist.

Fields

§index: usize

The missing index.

§

ObjectIndexMissing

Tried to fetch an index in an object that doesn’t exist.

Fields

§slot: usize

The static string slot corresponding to the index that is missing.

Trait Implementations§

Source§

impl Debug for VmError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for VmError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for VmError

Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Error for VmError

Source§

fn custom<T>(msg: T) -> Self
where T: Display,

Raised when there is general error when deserializing a type. Read more
Source§

fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a type different from what it was expecting. Read more
Source§

fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a value of the right type but that is wrong for some other reason. Read more
Source§

fn invalid_length(len: usize, exp: &dyn Expected) -> Self

Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
Source§

fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize enum type received a variant with an unrecognized name.
Source§

fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize struct type received a field with an unrecognized name.
Source§

fn missing_field(field: &'static str) -> Self

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.
Source§

fn duplicate_field(field: &'static str) -> Self

Raised when a Deserialize struct type received more than one of the same field.
Source§

impl From<Error> for VmError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<StackError> for VmError

Source§

fn from(source: StackError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V