Skip to main content

Module error

Module error 

Source
Expand description

§Error Handling

MinUI uses a single [Error] enum for all library errors. Most functions return Result<T> which is just Result<T, Error>.

§Error Types

  • Terminal initialization and window operations
  • Widget validation and rendering issues
  • Input processing problems
  • I/O and system-level errors
  • Dimension and bounds validation

§Usage

use minui::{Result, Error, TerminalWindow};

fn setup_ui() -> Result<()> {
    let window = TerminalWindow::new()?; // Uses ? for error propagation

    // Handle specific errors if needed
    match some_operation() {
        Err(Error::WidgetValidationError { message, hint }) => {
            println!("Widget problem: {}", message);
            if let Some(suggestion) = hint {
                println!("Try: {}", suggestion);
            }
        },
        Err(e) => println!("Error: {}", e),
        Ok(_) => {},
    }

    Ok(())
}

Enums§

Error
All possible MinUI errors.
ErrorSeverity
Error severity level for categorization

Type Aliases§

Result
Shorthand for std::result::Result<T, Error>.