Skip to main content

sevenmark_parser/
error.rs

1use std::fmt;
2use winnow::error::ContextError;
3
4#[derive(Debug, Clone, PartialEq)]
5pub enum SevenMarkError {
6    RecursionDepthExceeded { depth: usize, max_depth: usize },
7}
8
9impl fmt::Display for SevenMarkError {
10    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11        match self {
12            SevenMarkError::RecursionDepthExceeded { depth, max_depth } => {
13                write!(f, "Recursion depth exceeded: {} > {}", depth, max_depth)
14            }
15        }
16    }
17}
18
19impl std::error::Error for SevenMarkError {}
20
21impl SevenMarkError {
22    /// SevenMarkError를 winnow::error::ContextError로 변환
23    pub fn into_context_error(self) -> ContextError {
24        ContextError::new()
25    }
26}