dampen_cli/commands/check/
errors.rs1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
6pub enum CheckError {
7 #[error("Unknown attribute '{attr}' for widget '{widget}' in {file}:{line}:{col}{suggestion}")]
9 UnknownAttribute {
10 attr: String,
11 widget: String,
12 file: PathBuf,
13 line: u32,
14 col: u32,
15 suggestion: String,
16 },
17
18 #[error("Missing required attribute '{attr}' for widget '{widget}' in {file}:{line}:{col}")]
20 MissingRequiredAttribute {
21 attr: String,
22 widget: String,
23 file: PathBuf,
24 line: u32,
25 col: u32,
26 },
27
28 #[error("Unknown handler '{handler}' in {file}:{line}:{col}{suggestion}")]
30 UnknownHandler {
31 handler: String,
32 file: PathBuf,
33 line: u32,
34 col: u32,
35 suggestion: String,
36 },
37
38 #[error(
40 "Invalid binding field '{field}' in {file}:{line}:{col}. Available fields: {available}"
41 )]
42 InvalidBindingField {
43 field: String,
44 file: PathBuf,
45 line: u32,
46 col: u32,
47 available: String,
48 },
49
50 #[error(
52 "Duplicate radio value '{value}' in group '{group}' at {file}:{line}:{col}. First occurrence: {first_file}:{first_line}:{first_col}"
53 )]
54 DuplicateRadioValue {
55 value: String,
56 group: String,
57 file: PathBuf,
58 line: u32,
59 col: u32,
60 first_file: PathBuf,
61 first_line: u32,
62 first_col: u32,
63 },
64
65 #[error(
66 "Radio group '{group}' has inconsistent on_select handlers in {file}:{line}:{col}. Found handlers: {handlers}"
67 )]
68 InconsistentRadioHandlers {
69 group: String,
70 file: PathBuf,
71 line: u32,
72 col: u32,
73 handlers: String,
74 },
75
76 #[error(
78 "Invalid theme property '{property}' in theme '{theme}' at {file}:{line}:{col}: {message}. Valid properties: {valid_properties}"
79 )]
80 InvalidThemeProperty {
81 property: String,
82 theme: String,
83 file: PathBuf,
84 line: u32,
85 col: u32,
86 message: String,
87 valid_properties: String,
88 },
89
90 #[error("Theme '{theme}' has circular dependency: {cycle}")]
91 ThemeCircularDependency { theme: String, cycle: String },
92
93 #[error("Failed to load handler registry from {path}: {source}")]
95 HandlerRegistryLoadError {
96 path: PathBuf,
97 source: serde_json::Error,
98 },
99
100 #[error("Failed to load model info from {path}: {source}")]
101 ModelInfoLoadError {
102 path: PathBuf,
103 source: serde_json::Error,
104 },
105
106 #[error("Failed to load custom widget config from {path}: {source}")]
107 CustomWidgetConfigLoadError {
108 path: PathBuf,
109 source: serde_json::Error,
110 },
111
112 #[error("IO error: {0}")]
114 Io(#[from] std::io::Error),
115}