pub struct VfError { /* private fields */ }Expand description
The failure of one operation in a vectorized call.
Either a filesystem status failure attributable to a specific operation index, or a transport / client-side failure (where the index is optional because some failures cannot be attributed to one request). An indexed failure does not roll back an already-completed prefix, and a transport failure can make the outcome of an in-flight mutation ambiguous.
Construct errors through the typed factories and inspect them through methods; status domains and transport provenance cannot be modified independently.
let mut error = vfsi_core::VfError::failure(0, 2);
error.index = Some(9);Implementations§
Source§impl VfError
impl VfError
Sourcepub fn from_status(index: impl Into<Option<usize>>, status: StatusCode) -> Self
pub fn from_status(index: impl Into<Option<usize>>, status: StatusCode) -> Self
A typed status, with an optional logical request index.
pub fn failure(index: usize, err_no: u32) -> VfError
pub fn client(index: usize, code: u32) -> VfError
Sourcepub fn transport(
index: impl Into<Option<usize>>,
message: impl Into<String>,
) -> VfError
pub fn transport( index: impl Into<Option<usize>>, message: impl Into<String>, ) -> VfError
A transport / client-side failure. index is best-effort; pass None
when the failure cannot be attributed to a specific operation.
pub fn transport_with_kind( index: impl Into<Option<usize>>, kind: TransportKind, message: impl Into<String>, ) -> VfError
pub fn unsupported(index: usize) -> VfError
Sourcepub fn index(&self) -> Option<usize>
pub fn index(&self) -> Option<usize>
Logical request index, or None when a failure cannot be attributed.
An index is not a completion boundary: this item can itself contain
completed chunks, and other requests can already have changed state.
Sourcepub fn raw_code(&self) -> u32
pub fn raw_code(&self) -> u32
Raw code in the error’s status domain, or VF_ERR_RPC for transport.
Application code should use kind or typed
status, not compare this value to errno constants.
Sourcepub fn is_transport(&self) -> bool
pub fn is_transport(&self) -> bool
Whether this is a transport failure with no filesystem status.
Sourcepub fn transport_kind(&self) -> Option<TransportKind>
pub fn transport_kind(&self) -> Option<TransportKind>
Transport provenance only; this never authorizes mutation replay.
Sourcepub fn transport_message(&self) -> Option<&str>
pub fn transport_message(&self) -> Option<&str>
The backend’s transport diagnostic, without formatted index/path context.
Sourcepub fn with_index(self, index: usize) -> VfError
pub fn with_index(self, index: usize) -> VfError
Re-attribute this error to a different operation index.
Sourcepub fn map_index(self, map: impl FnOnce(usize) -> usize) -> VfError
pub fn map_index(self, map: impl FnOnce(usize) -> usize) -> VfError
Transform a known request index while preserving an unattributable
failure as None.
Sourcepub fn with_context(
self,
operation: &'static str,
path: impl Into<PathBuf>,
) -> Self
pub fn with_context( self, operation: &'static str, path: impl Into<PathBuf>, ) -> Self
Attach operation and path context without string parsing.
pub fn domain(&self) -> ErrorDomain
pub fn status(&self) -> Option<StatusCode>
pub fn operation(&self) -> Option<&'static str>
pub fn path(&self) -> Option<&Path>
Source§impl VfError
impl VfError
Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Portable category; Self::status retains the original status.
This is deliberately not retry guidance. Even a semantic failure can follow successful chunks of the same logical mutation. Reconcile state before replaying a mutation unless its idempotence is established.
Trait Implementations§
impl Eq for VfError
Source§impl Error for VfError
impl Error for VfError
1.30.0 · 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()