use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum CheckError {
#[error("Unknown attribute '{attr}' for widget '{widget}' in {file}:{line}:{col}{suggestion}")]
UnknownAttribute {
attr: String,
widget: String,
file: PathBuf,
line: u32,
col: u32,
suggestion: String,
},
#[error("Missing required attribute '{attr}' for widget '{widget}' in {file}:{line}:{col}")]
MissingRequiredAttribute {
attr: String,
widget: String,
file: PathBuf,
line: u32,
col: u32,
},
#[error("Unknown handler '{handler}' in {file}:{line}:{col}{suggestion}")]
UnknownHandler {
handler: String,
file: PathBuf,
line: u32,
col: u32,
suggestion: String,
},
#[error(
"Invalid binding field '{field}' in {file}:{line}:{col}. Available fields: {available}"
)]
InvalidBindingField {
field: String,
file: PathBuf,
line: u32,
col: u32,
available: String,
},
#[error(
"Duplicate radio value '{value}' in group '{group}' at {file}:{line}:{col}. First occurrence: {first_file}:{first_line}:{first_col}"
)]
DuplicateRadioValue {
value: String,
group: String,
file: PathBuf,
line: u32,
col: u32,
first_file: PathBuf,
first_line: u32,
first_col: u32,
},
#[error(
"Radio group '{group}' has inconsistent on_select handlers in {file}:{line}:{col}. Found handlers: {handlers}"
)]
InconsistentRadioHandlers {
group: String,
file: PathBuf,
line: u32,
col: u32,
handlers: String,
},
#[error(
"Invalid theme property '{property}' in theme '{theme}' at {file}:{line}:{col}: {message}. Valid properties: {valid_properties}"
)]
InvalidThemeProperty {
property: String,
theme: String,
file: PathBuf,
line: u32,
col: u32,
message: String,
valid_properties: String,
},
#[error("Theme '{theme}' has circular dependency: {cycle}")]
ThemeCircularDependency { theme: String, cycle: String },
#[error("Failed to load handler registry from {path}: {source}")]
HandlerRegistryLoadError {
path: PathBuf,
source: serde_json::Error,
},
#[error("Failed to load model info from {path}: {source}")]
ModelInfoLoadError {
path: PathBuf,
source: serde_json::Error,
},
#[error("Failed to load custom widget config from {path}: {source}")]
CustomWidgetConfigLoadError {
path: PathBuf,
source: serde_json::Error,
},
#[error(
"Duplicate tree node ID '{id}' at {file}:{line}:{col}. First occurrence: {first_file}:{first_line}:{first_col}"
)]
DuplicateTreeNodeId {
id: String,
file: PathBuf,
line: u32,
col: u32,
first_file: PathBuf,
first_line: u32,
first_col: u32,
},
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
}