Skip to main content

utiles_cover/
errors.rs

1use utiles_core::UtilesCoreError;
2
3#[derive(Debug)]
4pub struct UtilesCoverError {
5    pub message: String,
6}
7
8impl UtilesCoverError {
9    #[must_use]
10    pub fn new(message: &str) -> Self {
11        Self {
12            message: message.to_string(),
13        }
14    }
15}
16
17impl std::fmt::Display for UtilesCoverError {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        write!(f, "UtilesCoverError: {}", self.message)
20    }
21}
22
23impl std::error::Error for UtilesCoverError {
24    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
25        None
26    }
27}
28
29impl From<UtilesCoreError> for UtilesCoverError {
30    fn from(err: UtilesCoreError) -> Self {
31        Self::new(&err.to_string())
32    }
33}