#[non_exhaustive]pub enum SegmentError {
Io {
path: Option<PathBuf>,
source: Error,
},
Cbor {
phase: &'static str,
path: PathBuf,
message: String,
},
Cipher {
path: PathBuf,
message: String,
},
Integrity {
path: PathBuf,
reason: &'static str,
},
}Expand description
Errors produced by segment-buffer operations.
Every variant carries the path of the segment file
involved (when one is in scope), so an operator can act on the failure
without spelunking through logs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
Filesystem I/O failure (directory creation, segment read/write, rename, etc.).
Carries the offending path when one is in scope, plus the underlying
std::io::Error as source. When ? propagates an io::Error
without context, path is None; use
with_path (or construct the variant directly) to
attach the path at high-value call sites.
Fields
path: Option<PathBuf>Path of the file the I/O failed on, when known. None for
directory-create or unspecified-path failures.
source: ErrorThe underlying io::Error, reachable via std::error::Error::source.
Cbor
CBOR serialization or deserialization of a segment file failed.
Fields
Cipher
Cipher encrypt or decrypt of a segment file failed (key mismatch, AEAD tag invalid, cipher misconfiguration).
Fields
Integrity
Segment file failed an integrity check: truncated, too small for the AEAD nonce, or unrecognized envelope.
Implementations§
Source§impl SegmentError
impl SegmentError
Sourcepub fn with_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_path(self, path: impl Into<PathBuf>) -> Self
Attach a path to an existing SegmentError::Io variant. Returns the
error unchanged for other variants. Useful for upgrading a ?-propagated
io::Error to carry path context at a high-value call site.
Trait Implementations§
Source§impl Debug for SegmentError
impl Debug for SegmentError
Source§impl Display for SegmentError
impl Display for SegmentError
Source§impl Error for SegmentError
impl Error for SegmentError
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()