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 or connection-level failure.
Status
Server returned a non-success HTTP status.
The Display impl renders 401 and 403 as Authorization error: <url> to match upstream’s lfshttp.defaultError;
other statuses fall through to a plain server-side message
when a parseable error body is present, otherwise to a
generic server returned status N line.
Fields
url: Option<String>Request URL the server responded to. Embedded in the
Display impl so users can see which endpoint failed.
lfs_authenticate: Option<String>LFS-Authenticate response header, mirrored verbatim.
Only present on 401 responses; signals which auth scheme
the server wants.
body: Option<ServerError>Parsed LFS error body when the response carried one.
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 responses (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.