mical_cli_config/
error.rs1use core::fmt;
2use mical_cli_syntax::TextRange;
3
4#[derive(Clone, Debug, PartialEq, Eq)]
6pub enum ConfigError {
7 MissingSyntax { range: TextRange },
12
13 InvalidEscape { range: TextRange, sequence: String },
15}
16
17impl fmt::Display for ConfigError {
18 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19 match self {
20 ConfigError::MissingSyntax { range } => {
21 write!(f, "missing syntax element at {:?}", range)
22 }
23 ConfigError::InvalidEscape { range, sequence } => {
24 write!(f, "invalid escape sequence '{}' at {:?}", sequence, range)
25 }
26 }
27 }
28}