#[non_exhaustive]pub enum Error {
Json(Error),
Parse(String),
Validation {
errors: ValidationErrors,
},
Pointer {
pointer: String,
reason: String,
},
Binding {
expression: String,
reason: String,
},
Catalog(String),
RecoveryExhausted {
attempts: u32,
last: ValidationErrors,
},
}Expand description
Everything that can go wrong while producing, validating, or transporting A2UI.
The variants are deliberately coarse: A2UI is a wire protocol, so the useful
detail almost always lives in the payload (a crate::validate::ValidationError
list, a JSON Pointer, the offending literal) rather than in the discriminant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Json(Error)
The bytes were not JSON, or were not JSON of the expected shape.
Parse(String)
An LLM response could not be split into conversational text and A2UI blocks, or a block did not contain usable JSON.
Validation
A syntactically well-formed payload that violates A2UI semantics.
Carries the full machine-readable error list so a caller can feed it
straight back to a model; see crate::toolkit::recovery.
Fields
errors: ValidationErrorsThe full machine-readable error list.
Pointer
A JSON Pointer was malformed, or resolved to a location that cannot be written (for example indexing past the end of an array).
Fields
Binding
A ${...} expression in a formatString template could not be parsed
or evaluated.
Fields
Catalog(String)
A catalog document could not be interpreted as an A2UI catalog.
RecoveryExhausted
A model failed to produce a valid surface within
MAX_A2UI_ATTEMPTS attempts.
Fields
last: ValidationErrorsThe validation errors from the final attempt.
Implementations§
Source§impl Error
impl Error
Sourcepub fn parse(reason: impl Display) -> Self
pub fn parse(reason: impl Display) -> Self
Builds a Error::Parse from anything printable.
Sourcepub fn catalog(reason: impl Display) -> Self
pub fn catalog(reason: impl Display) -> Self
Builds a Error::Catalog from anything printable.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()