pub enum ApiError {
Transport(Error),
Status {
status: u16,
url: Option<String>,
lfs_authenticate: Option<String>,
body: Option<ServerError>,
retry_after: Option<Duration>,
},
Decode(String),
Url(ParseError),
CredentialsNotFound {
url: String,
detail: Option<String>,
},
}Expand description
Errors returned by the API client.
Variants§
Transport(Error)
Network / TLS / connection-level failure.
Status
Server returned a non-success HTTP status. body is Some if the
response had a parseable LFS error body. lfs_authenticate mirrors
the LFS-Authenticate response header (only present on 401). url
is the request URL — used by the Display impl to format
Authorization error: <url> for 401/403, mirroring upstream’s
lfshttp.defaultError strings.
Fields
body: Option<ServerError>Decode(String)
JSON body did not match the expected schema.
Url(ParseError)
Failed to construct the request URL from the endpoint.
CredentialsNotFound
git credential couldn’t supply usable credentials for the
endpoint. detail carries the underlying helper-side reason
(e.g. credential value for path contains newline: …) when
available; absent when every helper just returned “I don’t know”.
Format mirrors upstream’s creds.FillCreds.
Implementations§
Source§impl ApiError
impl ApiError
True for 401 responses — caller should resolve credentials and retry.
Sourcepub fn is_forbidden(&self) -> bool
pub fn is_forbidden(&self) -> bool
True for 403 responses — caller lacks permission for this operation.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
True for 404 responses.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
True for 5xx and 408/429 — transient errors a caller may want to retry.
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
Server-supplied retry delay, if any. Pulled from the
Retry-After response header at decode time. Mirrors upstream’s
errors.NewRetriableLaterError gate; falls back to exponential
backoff at the call site when None.
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
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()
Source§impl From<ApiError> for CreateLockError
impl From<ApiError> for CreateLockError
Source§impl From<ParseError> for ApiError
impl From<ParseError> for ApiError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for ApiError
impl !RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
impl !UnwindSafe for ApiError
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.