#[non_exhaustive]pub enum VerifyError {
InvalidAuthentication,
ProviderError(String),
ProviderResponse(ProviderResponseError),
HttpError(Error),
}Expand description
Errors from provider client verification.
Inspect provider failures with Self::provider_response_body,
Self::provider_response_json, and Self::provider_response_status.
Note: no provider path currently constructs Self::ProviderResponse for
verification; real verify failures surface as Self::HttpError, which
the helpers read. The variant is kept for symmetry with the other capability
errors and for future provider paths that preserve a 2xx error envelope.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidAuthentication
ProviderError(String)
ProviderResponse(ProviderResponseError)
Raw error response preserved from the provider
HttpError(Error)
Implementations§
Source§impl VerifyError
impl VerifyError
Sourcepub fn from_http_response(status: StatusCode, body: impl Into<String>) -> Self
pub fn from_http_response(status: StatusCode, body: impl Into<String>) -> Self
Builds an error from a captured HTTP status and raw response body,
routing it so the provider_response_* helpers stay useful.
This is the single funnel every HTTP-error path should use instead
of flattening a status and body into a ProviderError(String):
- A success (2xx) status carries a provider-authored error
envelope, so it is preserved as
Self::ProviderResponsetogether with the status. - A non-success status is preserved as
Self::HttpError(http_client::Error::InvalidStatusCodeWithMessage).
Either way the raw body is kept verbatim and the status stays
recoverable through Self::provider_response_status. Read the
response body exactly once and hand it here for both branches.
Sourcepub fn from_provider_body(body: impl Into<String>) -> Self
pub fn from_provider_body(body: impl Into<String>) -> Self
Preserves a raw provider error body that has no HTTP status.
Use this for non-HTTP transports (gRPC / SDK clients such as AWS
Bedrock, Vertex AI, or the gRPC Gemini client) where the provider
returns an error payload but no http::StatusCode is available.
The body is preserved as Self::ProviderResponse with
status == None, so Self::provider_response_body still surfaces
it while Self::provider_response_status returns None.
Sourcepub fn provider_response_body(&self) -> Option<&str>
pub fn provider_response_body(&self) -> Option<&str>
Returns the raw provider response body when available.
This is available for:
Self::ProviderResponseusing its preserved body.Self::HttpErrorwhen it wraps an HTTP non-success response that carries a body.
Returns None for any other variant — for example a Rig-generated
ProviderError diagnostic, or a failure from a transport with no
provider response body to preserve. An empty preserved body is
reported as Some("") (the provider returned no payload), which is
distinct from None; note that Self::provider_response_json
maps that same empty body to Ok(None).
Sourcepub fn provider_response_json(&self) -> Result<Option<Value>, Error>
pub fn provider_response_json(&self) -> Result<Option<Value>, Error>
Parses the provider response body as JSON.
Returns:
Ok(Some(value))when a body is present and valid JSON.Ok(None)when no provider response body is available.Err(error)when a body is present but isn’t valid JSON.
Sourcepub fn provider_response_status(&self) -> Option<StatusCode>
pub fn provider_response_status(&self) -> Option<StatusCode>
Returns the HTTP status code when this error preserves one, either from a non-success HTTP response, from a preserved provider response, or from a 2xx error envelope.
Warning: this can return a 2xx status. Some providers send
an error envelope alongside a success status, which Rig preserves
via Self::ProviderResponse. Callers must not infer failure from
the status code alone — the existence of this error already means
the call failed. Returns None for non-HTTP transports (gRPC / SDK
clients) and for variants that carry no provider response.
Trait Implementations§
Source§impl Debug for VerifyError
impl Debug for VerifyError
Source§impl Display for VerifyError
impl Display for VerifyError
Source§impl Error for VerifyError
impl Error for VerifyError
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 VerifyError
impl !RefUnwindSafe for VerifyError
impl !UnwindSafe for VerifyError
impl Send for VerifyError
impl Sync for VerifyError
impl Unpin for VerifyError
impl UnsafeUnpin for VerifyError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> DebuggableStorage for 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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> 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.