#[non_exhaustive]pub enum Error {
Show 14 variants
Request(String),
Snapshot(String),
Json(Error),
Core(Error),
Decode(String),
Protocol(String),
Patch {
target: String,
message: String,
},
InvalidPatchDocument {
target: String,
message: String,
},
State(Error),
Run {
message: String,
code: Option<String>,
},
Http {
status: u16,
body: String,
},
UnexpectedContentType(String),
Transport(Box<dyn Error + Send + Sync>),
Config(String),
}client only.Expand description
Everything that can go wrong while consuming an AG-UI stream.
The variant list is #[non_exhaustive]: new transports and validation rules
are expected to add variants without a breaking release.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Request(String)
A local request failed before dispatch.
Snapshot(String)
A saved local conversation is invalid or unsupported.
Json(Error)
A frame’s payload was not valid JSON, or not a valid Event.
Core(Error)
An error raised by the core protocol types.
Core’s protocol violations do not arrive here: they are flattened into
Error::Protocol so that every rule a stream can break has one shape.
Decode(String)
The bytes were not well-formed text/event-stream.
Protocol(String)
The stream parsed, but broke a rule the protocol requires — a content event with no open message, a chunk with no id to attach to, events after the run finished.
Patch
An RFC 6902 patch could not be applied.
The target document is left exactly as it was: json_patch::patch
rolls back the operations it had already applied, so a rejected patch
never leaves half-mutated state behind.
Fields
InvalidPatchDocument
A patch document is structurally invalid, before application is attempted.
A malformed JSON Pointer is a producer protocol error; unlike a valid operation targeting missing state, it cannot be retried against another state value.
Fields
State(Error)
The application state did not deserialize into the caller’s type.
The raw JSON state is still updated and correct; only the typed view is unavailable.
Run
The agent reported RUN_ERROR.
Fields
Http
The server answered with a status outside 2xx.
Fields
UnexpectedContentType(String)
A successful HTTP response chose a format this transport cannot decode.
Transport(Box<dyn Error + Send + Sync>)
The transport failed — a connection reset, a DNS failure, a closed channel. Carries the underlying error.
Config(String)
A transport was configured with something it cannot use: an unparseable URL, an invalid header name.
Implementations§
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()