textfsm-core 0.3.1

Core parsing library for TextFSM template-based state machine
Documentation
//! Error types for CliTable operations.

use std::collections::HashMap;
use std::path::PathBuf;

use thiserror::Error;

use crate::error::{ParseError, TemplateError};

/// Errors that occur during CliTable operations.
#[derive(Error, Debug)]
pub enum CliTableError {
    /// Error parsing the index file.
    #[error("index parse error at line {line}: {message}")]
    IndexParse { line: usize, message: String },

    /// No template matched the provided attributes.
    #[error("no matching template found for attributes: {0:?}")]
    NoMatch(HashMap<String, String>),

    /// Template file referenced in index was not found.
    #[error("template file not found: {0}")]
    TemplateNotFound(PathBuf),

    /// Invalid completion syntax in index file.
    #[error("invalid completion syntax: {0}")]
    InvalidCompletion(String),

    /// Invalid regex pattern in index file.
    #[error("invalid regex pattern at line {line}: {message}")]
    InvalidRegex { line: usize, message: String },

    /// Missing required column in index file.
    #[error("missing required column '{0}' in index file")]
    MissingColumn(String),

    /// Template parsing error.
    #[error(transparent)]
    Template(#[from] TemplateError),

    /// Text parsing error.
    #[error(transparent)]
    Parse(#[from] ParseError),

    /// I/O error.
    #[error("I/O error: {0}")]
    Io(#[from] std::io::Error),
}