Expand description
Error types for drasi-lib Error types for drasi-lib operations.
This module provides structured error types using thiserror for idiomatic Rust error handling.
The pattern follows major Rust libraries like tokio, reqwest, and sqlx:
- Public API returns
crate::error::Result<T>with structuredDrasiErrorvariants - Internal code uses
anyhow::Result<T>for flexibility - Error chains are preserved via
#[error(transparent)]for debugging
§Example
ⓘ
use drasi_lib::error::{DrasiError, Result};
fn example() -> Result<()> {
// Pattern match on specific error variants
match some_operation() {
Err(DrasiError::ComponentNotFound { component_type, component_id }) => {
println!("{} '{}' not found", component_type, component_id);
}
Err(DrasiError::InvalidState { message }) => {
println!("Invalid state: {}", message);
}
Err(e) => return Err(e),
Ok(v) => { /* ... */ }
}
Ok(())
}Enums§
- Drasi
Error - Main error type for drasi-lib operations.
Type Aliases§
- Result
- Result type for drasi-lib operations.