meowy-webring/shared/src/errors.rs

27 lines
639 B
Rust

#[derive(Debug)]
pub enum ErrorStatus {
IOError,
ParsingError,
DirectoriesError,
LoggerInitializationError,
NotFoundError,
AlreadyExistsError
}
pub struct Error {
pub status: ErrorStatus,
pub data: String,
}
pub(crate) static DIRECTORIES_ERROR_MESSAGE: &str = "could not retreive a valid home path from the operating system. maybe try to define the HOME enviroment variable if you\'re on a unix or unix like operating system.";
impl core::fmt::Debug for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"A {:?} error has occured.\nDetails: {}",
self.status, self.data
)
}
}