Strand Errors
Usage
Preserve typed failures and add context deliberately.
Preserve the error category
use strand_errors::{Result, StorageError, StrandError};
fn missing_block(index: u64) -> Result<()> {
Err(StorageError::BlockNotFound(index).into())
}
fn main() {
match missing_block(7) {
Err(StrandError::Storage(StorageError::BlockNotFound(index))) => {
eprintln!("block {index} is unavailable");
}
Err(error) => eprintln!("{error}"),
Ok(()) => {}
}
}StrandError wraps storage, crypto, protocol, ownership, replication and validation errors, plus Internal and NotImplemented. Match the typed inner error when choosing retry or rejection behavior. ErrorContext::context and with_context convert failures into StrandError::Internal strings; they do not preserve the original variant for later matching.
Source reference
Exact declarations and source provenance · Package features and manifest.