Expand description
Error types for the nectar-primitives crate
This module provides error types and helper functions for handling errors that occur in various components of the crate.
§Error Structure
The crate uses a two-level error hierarchy:
PrimitivesError: The top-level error type that wraps all other errors- Component-specific errors: More detailed errors from specific subsystems
(like
BmtErrorandChunkError)
§Example Usage
use nectar_primitives::error::{PrimitivesError, Result};
fn fallible_operation() -> Result<()> {
// Something that might fail
Ok(())
}
fn handle_errors() {
match fallible_operation() {
Ok(_) => println!("Operation succeeded"),
Err(e) => match e {
PrimitivesError::Bmt(bmt_err) => println!("BMT error: {}", bmt_err),
PrimitivesError::Chunk(chunk_err) => println!("Chunk error: {}", chunk_err),
_ => println!("Other error: {}", e),
}
}
}This design allows for detailed error reporting while maintaining a consistent interface across the crate.
Enums§
- Primitives
Error - Main error type for the primitives crate
Type Aliases§
- Result
- Result type for operations in the primitives crate