pub enum ApiError {
Transport(Error),
Status {
status: u16,
lfs_authenticate: Option<String>,
body: Option<ServerError>,
},
Decode(String),
Url(ParseError),
}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).
Decode(String)
JSON body did not match the expected schema.
Url(ParseError)
Failed to construct the request URL from the endpoint.
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.
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)>
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()
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
Converts to this type from the input type.
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
Mutably borrows from an owned value. Read more
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.