optionstratlib_math/error/mod.rs
1//! Errors owned by the math layer.
2//!
3//! Each failure here is raised by a generic math type: a curve, a surface, an
4//! interpolation or a statistic extracted from them. Errors raised by core
5//! types (`DecimalError`, `PositionError`, …) stay in `optionstratlib-core`,
6//! and the variants below that wrap them carry those types unchanged.
7//!
8//! # Canonical paths (#550)
9//!
10//! Every error type is exported flat from this module, for example
11//! `optionstratlib_math::error::CurveError`. The file module `curves` is
12//! private: it held nothing the flat paths do not, and was public only
13//! because 0.21 exposed it.
14//!
15//! ```rust
16//! use optionstratlib_math::error::{CurveError, CurvesResult};
17//! ```
18//!
19//! ```compile_fail,E0603
20//! use optionstratlib_math::error::curves::CurveError;
21//! ```
22//!
23//! ```compile_fail,E0603
24//! use optionstratlib_math::error::curves::CurvesResult;
25//! ```
26
27/// ### Curve Errors (`CurveError`)
28/// Handles:
29/// * Curve construction from points or parametric functions
30/// * Point lookup and segment search
31/// * Curve arithmetic and merging
32/// * Metric extraction over a curve
33mod curves;
34
35/// ### Interpolation Errors (`InterpolationError`)
36/// Manages:
37/// * Data point validation
38/// * Interpolation method errors
39/// * Boundary conditions
40/// * Mathematical approximation issues
41mod interpolation;
42
43/// ### Metrics Errors (`MetricsError`)
44/// Statistical, shape, range and trend metrics extracted from curves and
45/// surfaces.
46mod metrics;
47
48/// ### Surface Errors (`SurfaceError`)
49/// Covers:
50/// * Surface construction failures
51/// * Dimensional and data completeness errors
52/// * Surface arithmetic and interpolation
53mod surfaces;
54
55pub use curves::{CurveError, CurvesResult};
56pub use interpolation::InterpolationError;
57pub use metrics::MetricsError;
58pub use surfaces::SurfaceError;