pub enum TransferError {
ServerObject(ObjectError),
NoDownloadAction,
ActionStatus {
status: u16,
url: String,
retry_after: Option<Duration>,
},
Http(Error),
Io(Error),
Store(StoreError),
InvalidOid(OidParseError),
UnsupportedHashAlgo(String),
BatchResponse(Box<ApiError>),
ActionExpired {
rel: String,
},
}Expand description
Why a per-object transfer failed.
Errors with is_retryable() == true are retried by the queue up to
TransferConfig::max_attempts;
everything else fails fast.
Variants§
ServerObject(ObjectError)
The batch endpoint returned a per-object error (404, 410, 422, …).
Not retryable: the server has already classified the object.
NoDownloadAction
The batch response listed the object with neither actions nor
error for a download.
The spec forbids this, but real servers do it occasionally; surfaced here instead of panicking.
ActionStatus
The action URL responded with a non-success status.
The URL is embedded in the Display
impl so users can see which endpoint failed (in
particular, what insteadOf rewriting did to the original
batch URL).
retry_after carries the parsed Retry-After response
header when present; see retry_after.
Http(Error)
HTTP transport failure (connection reset, TLS error, …). Retryable.
Io(Error)
Local I/O while reading the object file (uploads) or the staging tempfile (downloads).
Store(StoreError)
The local store rejected the bytes (most importantly, a hash mismatch after a download).
Not retryable per attempt: the bytes the server gave us did not hash to what they promised.
InvalidOid(OidParseError)
The OID returned by the server is not valid hex.
UnsupportedHashAlgo(String)
The batch response advertised a hash_algo we don’t implement.
Per the spec the only required value is sha256; anything
else would mean recomputing every OID under a different
digest before trusting the server’s actions.
BatchResponse(Box<ApiError>)
The batch endpoint itself failed (network, auth, or decode).
Wraps the underlying ApiError with upstream’s batch response: prefix so a Display of this error matches what
users see in GIT_TRACE logs and shell-test grep patterns.
ActionExpired
The action URL the server returned is already expired (or expires within the safety buffer).
Surfacing this before the upload/download avoids hitting an action that’s guaranteed to fail. Upstream re-requests a fresh batch and retries; this crate fails fast for now.
Implementations§
Source§impl TransferError
impl TransferError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Worth another attempt?
Network blips and 5xx are retryable; spec violations and hash mismatches are not.
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
error-construction time. The retry loop uses this in place
of exponential backoff when Some. Mirrors upstream’s
errors.IsRetriableLaterError gate. Batch-level
Retry-After isn’t surfaced through BatchResponse yet.
Trait Implementations§
Source§impl Debug for TransferError
impl Debug for TransferError
Source§impl Display for TransferError
impl Display for TransferError
Source§impl Error for TransferError
impl Error for TransferError
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 TransferError
impl From<ApiError> for TransferError
Source§impl From<Error> for TransferError
impl From<Error> for TransferError
Source§impl From<Error> for TransferError
impl From<Error> for TransferError
Source§impl From<OidParseError> for TransferError
impl From<OidParseError> for TransferError
Source§fn from(source: OidParseError) -> Self
fn from(source: OidParseError) -> Self
Source§impl From<StoreError> for TransferError
impl From<StoreError> for TransferError
Source§fn from(source: StoreError) -> Self
fn from(source: StoreError) -> Self
Auto Trait Implementations§
impl Freeze for TransferError
impl !RefUnwindSafe for TransferError
impl Send for TransferError
impl Sync for TransferError
impl Unpin for TransferError
impl UnsafeUnpin for TransferError
impl !UnwindSafe for TransferError
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.