2023-07-01 06:12:55 +00:00
#[ derive(Debug) ]
pub enum ErrorStatus {
IOError ,
2023-07-02 01:27:03 +00:00
ParsingError ,
DirectoriesError ,
2023-07-02 05:10:58 +00:00
LoggerInitializationError ,
2023-07-02 05:14:33 +00:00
NotFoundError ,
2023-07-03 08:29:03 +00:00
AlreadyExistsError ,
2023-07-13 05:10:08 +00:00
GenericError ,
2023-07-01 06:12:55 +00:00
}
pub struct Error {
pub status : ErrorStatus ,
2023-07-02 01:27:03 +00:00
pub data : String ,
2023-07-01 06:12:55 +00:00
}
2023-07-02 01:27:03 +00:00
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. " ;
2023-07-01 06:12:55 +00:00
impl core ::fmt ::Debug for Error {
2023-07-02 01:27:03 +00:00
fn fmt ( & self , f : & mut std ::fmt ::Formatter < '_ > ) -> std ::fmt ::Result {
write! (
f ,
" A {:?} error has occured. \n Details: {} " ,
self . status , self . data
)
}
2023-07-01 06:12:55 +00:00
}