Skip to main content

Module error

Module error 

Source
Expand description

Error types for the CLI module.

This module provides a comprehensive error type system for the CLI, enabling precise error handling and helpful error messages.

§Design Goals

  • Structured errors: Each error type captures context for debugging
  • Helpful messages: Error display includes suggestions when possible
  • Easy matching: Errors can be matched on to handle specific cases
  • Composable: Errors can wrap underlying causes

§Example

use lockstep::cli::error::{CliError, CliResult};

fn load_config(path: &str) -> CliResult<Config> {
    let content = std::fs::read_to_string(path)
        .map_err(|e| CliError::config_io(path, e))?;
     
    toml::from_str(&content)
        .map_err(|e| CliError::config_parse(path, e))
}

Enums§

CliError
Comprehensive error type for CLI operations.

Type Aliases§

CliResult
Result type alias for CLI operations.