forked from StrafesNET/map-tool
22 lines
459 B
Rust
22 lines
459 B
Rust
#[derive(Debug)]
|
|
pub struct Error {
|
|
pub message: String,
|
|
}
|
|
|
|
impl std::fmt::Display for Error {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
write!(f, "{}", self.message)
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for Error {}
|
|
|
|
impl Error {
|
|
// has to be Box<Self> to fit with the result in prelude.rs
|
|
pub fn new(message: &str) -> Box<Self> {
|
|
Box::new(Self {
|
|
message: message.to_string(),
|
|
})
|
|
}
|
|
}
|