pub enum CompletionError {
RequestError(Box<dyn Error + Send + Sync + 'static>),
ResponseError(String),
ProviderError {
message: String,
class: ErrorClass,
},
JsonError(Error),
}Expand description
Error invoking a completion model.
Variants§
RequestError(Box<dyn Error + Send + Sync + 'static>)
Error building the completion request.
ResponseError(String)
Error parsing the completion response.
ProviderError
Error returned by the completion model provider, with the provider’s retry classification.
JsonError(Error)
JSON (de)serialization error.
Implementations§
Source§impl CompletionError
impl CompletionError
Sourcepub fn provider(class: ErrorClass, message: impl Into<String>) -> Self
pub fn provider(class: ErrorClass, message: impl Into<String>) -> Self
A provider error with an explicit retry classification.
Sourcepub fn class(&self) -> ErrorClass
pub fn class(&self) -> ErrorClass
How callers should treat this error.
RequestErrorandJsonErrorare our side failing to build or parse — retrying the same request cannot help (ErrorClass::Fatal).ResponseErroris a transport/framing failure while reading the response — typically transient.ProviderErrorcarries the provider’s own classification.
Trait Implementations§
Source§impl Debug for CompletionError
impl Debug for CompletionError
Source§impl Display for CompletionError
impl Display for CompletionError
Source§impl Error for CompletionError
impl Error for CompletionError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for CompletionError
impl !UnwindSafe for CompletionError
impl Freeze for CompletionError
impl Send for CompletionError
impl Sync for CompletionError
impl Unpin for CompletionError
impl UnsafeUnpin for CompletionError
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