Skip to main content

mical_cli_config/
error.rs

1use core::fmt;
2use mical_cli_syntax::TextRange;
3
4#[derive(Clone, Debug, PartialEq, Eq)]
5pub enum Error {
6    InvalidEscape { range: TextRange, sequence: String },
7    EmptyExpace { range: TextRange },
8}
9
10impl fmt::Display for Error {
11    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12        match self {
13            Error::InvalidEscape { range, sequence } => {
14                write!(f, "invalid escape sequence '{}' at {:?}", sequence, range)
15            }
16            Error::EmptyExpace { range } => {
17                write!(f, "empty expace at {:?}", range)
18            }
19        }
20    }
21}