#[non_exhaustive]pub enum Error {
InvalidConfiguration(InvalidConfiguration),
Transport {
source: Error,
},
Timeout {
duration: Duration,
source: Error,
},
Provider {
status: StatusCode,
failure: ProviderFailure,
},
InvalidResponse {
source: Error,
},
ResponseTooLarge {
limit_bytes: usize,
},
MissingChoice,
MissingToolCall,
MissingContent,
Tool(ToolError),
}Expand description
Errors returned while configuring or calling the provider endpoint.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InvalidConfiguration(InvalidConfiguration)
A local configuration value violated its invariant.
Transport
The HTTP exchange failed before a complete response body was received.
Timeout
The configured request deadline elapsed.
Fields
Provider
The provider returned a non-success HTTP status.
Fields
§
status: StatusCodeThe HTTP status returned by the provider.
§
failure: ProviderFailureA sanitized, typed representation of the provider failure.
InvalidResponse
A success response did not match the supported typed contract.
ResponseTooLarge
The response body exceeded the configured safety limit.
MissingChoice
A completion did not contain any choices.
MissingToolCall
A tool-call completion did not contain a tool call.
MissingContent
A final completion did not contain text content.
Tool(ToolError)
A typed tool contract was invalid or could not decode provider output.
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<InvalidConfiguration> for Error
impl From<InvalidConfiguration> for Error
Source§fn from(source: InvalidConfiguration) -> Self
fn from(source: InvalidConfiguration) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more