1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::{error::Error, fmt};

#[derive(Debug, Eq, PartialEq)]
pub enum EmbossError {
    UnexpectedValueEnd,
    MissingIdent,
}

impl fmt::Display for EmbossError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            EmbossError::UnexpectedValueEnd => {
                write!(
                    f,
                    "Prematurely reached the end of metadata value during extraction"
                )
            }
            EmbossError::MissingIdent => {
                write!(
                    f,
                    "Metadata identifier is either blank or comprised entirely of whitespace"
                )
            }
        }
    }
}

impl Error for EmbossError {}