Module error

Module error 

Source
Expand description

Error types for clock-curve-math.

This module defines the comprehensive error types used throughout the clock-curve-math library for cryptographic operations.

§Error Categories

Errors are categorized by the type of validation or operation failure:

§Input Validation Errors

§Buffer Errors

§Arithmetic Errors

§Future Extension Errors

§Error Handling

Most operations return Result<T, MathError> to allow callers to handle errors appropriately. Some operations (like basic arithmetic) may panic on invalid inputs for security reasons, while others provide checked variants that return errors.

use clock_curve_math::{FieldElement, MathError};

// Operations that return errors
let result = FieldElement::from_bytes(&[0u8; 32]);
match result {
    Ok(element) => println!("Valid field element: {:?}", element),
    Err(MathError::InvalidFieldElement) => println!("Invalid field element"),
    Err(e) => println!("Other error: {:?}", e),
}

Enums§

MathError
Errors that can occur in mathematical operations.