Skip to main content

Module error

Module error 

Source
Expand description

Error handling for probabilistic programming operations.

This module provides structured error types with rich context information for graceful handling of common failure modes in probabilistic computation.

§Scope (finding FG-33)

ErrorCode intentionally only enumerates codes that fugue’s own code paths actually construct today, verified with grep -rn 'ErrorCode::' src/. An earlier revision of this module carried 22 variants across 6 categories (numerical instability, inference non-convergence, trace corruption, …) of which only 11 were ever produced by real logic; the rest were aspirational placeholders that overstated how much of the crate’s failure surface was actually captured by structured errors (the numerical/model-execution paths they were meant for return NaN/-inf or panic-free Options instead, or — for crate::inference::vi::GuideError and crate::inference::abc::ABCError — got dedicated, more precise algorithm-specific error types rather than being shoehorned into this general enum). See CHANGELOG.md for the removed list.

The live codes today:

CodeCategoryConstructed in
InvalidMean/InvalidVariance/InvalidProbability/InvalidRange/InvalidShape/InvalidRate/InvalidCountDistribution validation (1xx)core::distribution constructors
AddressConflictModel execution (3xx)runtime::interpreters (duplicate sample address)
UnexpectedModelStructureModel execution (3xx)runtime::interpreters (replay/score structure mismatch)
TraceAddressNotFoundTrace manipulation (5xx)runtime::trace typed accessors
TypeMismatchType system (6xx)runtime::trace typed accessors

Structs§

ErrorContext
Enhanced error context providing debugging information.

Enums§

ErrorCategory
High-level error categories for filtering and handling.
ErrorCode
Error codes for programmatic error handling and categorization.
FugueError
Errors that can occur during probabilistic programming operations.

Traits§

Validate
Trait for validating distribution parameters.

Type Aliases§

FugueResult
Result type for fallible probabilistic operations.