use thiserror::Error;
#[derive(Error, Debug)]
pub enum JsonExtractError {
#[error("File not found: {0}")]
FileNotFound(String),
#[error("Invalid JSON syntax in {file}: {error}")]
InvalidJson {
file: String,
error: String,
},
#[error("Field not found: {0}")]
FieldNotFound(String),
#[error("Array index out of bounds: {path}[{index}], array length: {length}")]
ArrayIndexOutOfBounds {
path: String,
index: usize,
length: usize,
},
#[error("Not an array: {0}")]
NotAnArray(String),
#[error("Invalid array index: {0}")]
InvalidArrayIndex(String),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("JSON serialization error: {0}")]
JsonError(#[from] serde_json::Error),
#[error("Not an object: {0}")]
NotAnObject(String),
#[error("Invalid field path: {0}")]
InvalidFieldPath(String),
#[error("Invalid value type: {0}")]
InvalidValueType(String),
}