1
0
forked from Rativel/BurritOS
Files
BurritOS/src/simulator/error.rs
2023-03-23 20:04:21 +01:00

27 lines
525 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 {
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)
}
}