#[non_exhaustive]pub enum Error {
MissingApiKey(String),
Http(Box<dyn Error + Send + Sync>),
Provider {
status: u16,
body: String,
},
Decode(Error),
UnknownTool(String),
InvalidArguments {
tool: String,
message: String,
},
Tool {
tool: String,
message: String,
},
MaxIterations(usize),
Io(Error),
Other(String),
}Expand description
Errors that can arise while configuring or running an crate::Agent.
#[non_exhaustive] so new variants can be added without a breaking release;
match with a _ arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingApiKey(String)
No API key was provided and none could be found in the environment.
Http(Box<dyn Error + Send + Sync>)
The HTTP transport failed. The underlying error is kept as an opaque
source rather than exposing the reqwest type, so a transport-library
bump is not a breaking change for this crate’s public API.
Provider
The provider returned a non-success status.
Decode(Error)
A response body could not be parsed.
UnknownTool(String)
The model asked for a tool that isn’t registered.
InvalidArguments
A tool’s input arguments were not valid for its schema.
Tool
A tool failed while executing.
MaxIterations(usize)
The agent loop exceeded its configured iteration budget.
Io(Error)
An I/O operation failed.
Other(String)
Catch-all for everything else.
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()