Strand Errors
Usage
Using `strand-errors` — attach structured context, propagate typed errors across crate boundaries, and bridge std::io errors.
Purpose
Shared error hierarchy, serialization, context wrappers, error codes, and IO mapping.
This page follows the real source shape for Strand Errors and explains the workflow a developer is likely to use first.
Developer workflow
Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.
Primary types to know
SerializedError— libs/strand-errors/src/lib.rsCryptoError— libs/strand-errors/src/lib.rsErrorCode— libs/strand-errors/src/lib.rsOwnershipError— libs/strand-errors/src/lib.rsProtocolError— libs/strand-errors/src/lib.rsReplicationError— libs/strand-errors/src/lib.rsStorageError— libs/strand-errors/src/lib.rsStrandError— libs/strand-errors/src/lib.rsValidationError— libs/strand-errors/src/lib.rsErrorContext— libs/strand-errors/src/lib.rsToIoErrorKind— libs/strand-errors/src/lib.rs
Example shape
use strand::{Strand, StrandConfig};
use strand_errors::StrandError;
#[tokio::main]
async fn main() {
let cfg = StrandConfig::new(); // no storage path — produces an error on append
let mut strand = Strand::new(cfg).await.unwrap();
match strand.append(b"x").await {
Ok(seq) => println!("appended at {seq}"),
Err(StrandError::Storage(msg)) => eprintln!("storage error: {msg}"),
Err(e) => eprintln!("other error: {e}"),
}
}