Expand description
§Execution Error Handler
Defines all error types that can occur during VM execution and provides comprehensive error handling capabilities.
§Error Categories
- Stack Errors: Underflow, overflow, invalid operations
- Type Errors: Invalid type conversions, unsupported operations
- Runtime Errors: General execution failures, exceptions
- Memory Errors: Heap allocation failures, invalid references
- Control Flow Errors: Invalid jumps, function call failures
§Error Handling Strategy
The VM uses a comprehensive error handling strategy:
- Immediate Detection: Errors are detected as soon as they occur
- Detailed Information: Each error contains context about what went wrong
- Recovery Options: Some errors can be recovered from automatically
- User Feedback: Clear error messages for debugging
§Usage
use jetcrab::vm::executor::error_handler::ExecutionError;
match some_operation() {
Ok(result) => println!("Success: {:?}", result),
Err(ExecutionError::StackUnderflow) => {
eprintln!("Stack underflow occurred");
}
Err(ExecutionError::TypeError(msg)) => {
eprintln!("Type error: {}", msg);
}
Err(e) => eprintln!("Other error: {:?}", e),
}Enums§
- Execution
Error - Represents all possible errors that can occur during VM execution