Module error

Module error 

Source
Expand description

Error types and result aliases Error types and handling for blz-core operations.

This module provides a comprehensive error type that covers all possible failures in the blz cache system. Errors are categorized for easier handling and include context about recoverability for retry logic.

§Error Categories

Errors are organized into logical categories:

  • I/O Errors: File system operations, disk access
  • Network Errors: HTTP requests, connectivity issues
  • Parse Errors: Markdown parsing, TOML/JSON deserialization
  • Index Errors: Search index operations
  • Storage Errors: Cache storage operations
  • Configuration Errors: Invalid settings or config files
  • Resource Errors: Memory limits, timeouts, quotas

§Recovery Hints

Errors include information about whether they might be recoverable through retries:

use blz_core::{Error, Result, MarkdownParser};

fn handle_operation() -> Result<()> {
    match perform_operation() {
        Err(e) if e.is_recoverable() => {
            println!("Temporary failure, retrying...");
            // Implement retry logic
        }
        Err(e) => {
            println!("Permanent failure: {}", e);
            println!("Category: {}", e.category());
        }
        Ok(()) => println!("Success"),
    }
    Ok(())
}

fn perform_operation() -> Result<()> { Ok(()) }

Enums§

Error
The main error type for blz-core operations.

Type Aliases§

Result
Convenience type alias for std::result::Result<T, Error>.