Module error

Module error 

Source
Expand description

Error types for dotmax operations

This module defines DotmaxError, the primary error type returned by all public dotmax APIs. All errors include contextual information (coordinates, dimensions, indices) to aid debugging.

§Zero Panics Policy

All public API methods return Result<T, DotmaxError> instead of panicking. This ensures applications can gracefully handle all error conditions.

§Examples

use dotmax::{BrailleGrid, DotmaxError};

// Create grid with invalid dimensions
let result = BrailleGrid::new(0, 10);
match result {
    Err(DotmaxError::InvalidDimensions { width, height }) => {
        println!("Invalid dimensions: {}×{}", width, height);
    }
    _ => unreachable!(),
}

// Access out-of-bounds coordinates
let mut grid = BrailleGrid::new(10, 10).unwrap();
let result = grid.set_dot(100, 50);
match result {
    Err(DotmaxError::OutOfBounds { x, y, width, height }) => {
        println!("({}, {}) is outside {}×{} grid", x, y, width, height);
    }
    _ => unreachable!(),
}

Enums§

DotmaxError
Comprehensive error type for all dotmax operations