Files
scootaloo/src/error.rs
2022-08-11 12:33:05 +02:00

26 lines
454 B
Rust

use std::{
error::Error,
fmt::{Display, Formatter, Result},
};
#[derive(Debug)]
pub struct ScootalooError {
details: String,
}
impl ScootalooError {
pub fn new(msg: &str) -> ScootalooError {
ScootalooError {
details: msg.to_string(),
}
}
}
impl Error for ScootalooError {}
impl Display for ScootalooError {
fn fmt(&self, f: &mut Formatter) -> Result {
write!(f, "{}", self.details)
}
}