pub enum Error {
Http(Error),
Json(Error),
Api {
status: u16,
message: String,
},
RateLimit {
retry_after: u64,
},
InvalidRequest(String),
Configuration(String),
Stream(String),
Timeout(u64),
RetryExhausted(u32),
VectorStore(String),
}Expand description
The main error type for all Cognate operations.
Variants§
Http(Error)
An HTTP-level transport error from reqwest.
Json(Error)
JSON serialisation or deserialisation failed.
Api
The provider API returned an error status code.
Fields
RateLimit
The provider rate-limited this request.
InvalidRequest(String)
The request was invalid (missing required field, bad parameter, etc.).
Configuration(String)
The provider is not configured correctly (missing API key, bad URL, etc.).
Stream(String)
An error occurred while reading or parsing a streaming response.
Timeout(u64)
The request exceeded the configured timeout.
RetryExhausted(u32)
All automatic retry attempts were exhausted.
VectorStore(String)
A vector store operation failed.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_rate_limit(&self) -> bool
pub fn is_rate_limit(&self) -> bool
Returns true if this error is a rate-limit error.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is safe to retry automatically.
Sourcepub fn retry_after(&self) -> Option<u64>
pub fn retry_after(&self) -> Option<u64>
Return the recommended retry delay in seconds, if known.
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()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.