Files
burritos/src/simulator/error.rs
François Autin 928628c305 📝 Documentation updates
2023-03-24 18:11:37 +01:00

28 lines
558 B
Rust

use std::fmt;
/// Machine Error
/// This error serves as a specific exception handler for the Machine struct
#[derive(Debug, Clone)]
pub struct MachineError {
/// The error message
message: String
}
impl MachineError {
/// MachineError constructor
pub fn new(message: &str) -> MachineError {
MachineError {
message: message.to_string()
}
}
}
impl fmt::Display for MachineError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Machine error: {}", &self.message)
}
}