format_error

Function format_error 

Source
pub fn format_error(error: &DynamicCliError) -> String
Expand description

Format an error with coloring

Generates a formatted string with colors and suggestions. Can be used for logging or custom display.

§Arguments

  • error - The error to format

§Returns

Formatted string with ANSI color codes (if colored-output feature is enabled)

§Example

use dynamic_cli::error::{format_error, ConfigError};
use std::path::PathBuf;

let error = ConfigError::FileNotFound {
    path: PathBuf::from("config.yaml"),
};
let formatted = format_error(&error.into());
assert!(formatted.contains("Error:"));
assert!(formatted.contains("config.yaml"));