Skip to main content

toon_validate_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum TqError {
5    #[error("IO error: {0}")]
6    Io(#[from] std::io::Error),
7    
8    #[error("Parse error at line {line}: {message}")]
9    Parse { line: usize, message: String },
10    
11    #[error("JSON parse error: {0}")]
12    JsonParse(#[from] serde_json::Error),
13    
14    #[error("Validation error: {0}")]
15    Validation(String),
16    
17    #[error("Table {name} declared with {declared} rows but found {actual}")]
18    TableRowMismatch {
19        name: String,
20        declared: usize,
21        actual: usize,
22    },
23    
24    #[error("Inconsistent table schema in {name}: {message}")]
25    TableSchemaInconsistent { name: String, message: String },
26    
27    #[error("Invalid input format: {0}")]
28    InvalidFormat(String),
29}
30
31pub type Result<T> = std::result::Result<T, TqError>;