irc_rust/
errors.rs

1use std::error::Error;
2
3#[derive(Debug, Eq, PartialEq)]
4pub enum ParserError {
5    NoTagKeyEnd,
6    NoTagValueEnd,
7    NoCommand,
8    PrefixWithoutName,
9}
10
11impl std::fmt::Display for ParserError {
12    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13        match self {
14            ParserError::NoTagKeyEnd => write!(f, "Tag Key has no ending '='"),
15            ParserError::NoTagValueEnd => write!(f, "Tag Value has no ending ';' or ' '"),
16            ParserError::NoCommand => write!(f, "Missing command in message"),
17            ParserError::PrefixWithoutName => write!(f, "Prefix has to have name included"),
18        }
19    }
20}
21
22impl Error for ParserError {}