textfsm_rs/
error.rs

1use std::io;
2use thiserror::Error;
3
4/// Custom error type for TextFSM operations.
5#[derive(Debug, Error)]
6pub enum TextFsmError {
7    /// Errors related to file I/O.
8    #[error("I/O error: {0}")]
9    IoError(#[from] io::Error),
10    /// Errors related to CSV parsing.
11    #[cfg(any(feature = "clitable", feature = "csv_export"))]
12    #[error("CSV error: {0}")]
13    CsvError(#[from] csv::Error),
14    /// Errors occurring during the parsing of templates or variable strings.
15    #[error("Parse error: {0}")]
16    ParseError(String),
17    /// Errors related to invalid states or state transitions.
18    #[error("State error: {0}")]
19    StateError(String),
20    /// Unrecoverable internal library errors.
21    #[error("Internal error: {0}")]
22    InternalError(String),
23}
24
25/// A specialized Result type for TextFSM operations.
26pub type Result<T> = std::result::Result<T, TextFsmError>;