Skip to main content

a2ui_base/
error.rs

1/// Unified error type for all A2UI operations.
2#[derive(Debug, thiserror::Error)]
3pub enum A2uiError {
4    #[error("validation error: {0}")]
5    Validation(String),
6
7    #[error("parse error: {0}")]
8    Parse(#[from] serde_json::Error),
9
10    #[error("surface already exists: {0}")]
11    SurfaceExists(String),
12
13    #[error("surface not found: {0}")]
14    SurfaceNotFound(String),
15
16    #[error("component not found: {0}")]
17    ComponentNotFound(String),
18
19    #[error("invalid function call: {0}")]
20    InvalidFunctionCall(String),
21
22    #[error("invalid JSON pointer: {0}")]
23    InvalidPointer(String),
24
25    #[error("catalog not found: {0}")]
26    CatalogNotFound(String),
27
28    #[error("missing required property '{property}' on component '{component}'")]
29    MissingProperty { component: String, property: String },
30
31    #[error("type mismatch: {0}")]
32    TypeMismatch(String),
33
34    #[error("no native implementation for function: {0}")]
35    NoNativeImplementation(String),
36
37    #[error("IO error: {0}")]
38    Io(#[from] std::io::Error),
39}
40
41pub type Result<T> = std::result::Result<T, A2uiError>;