pub enum FugueError {
InvalidParameters {
distribution: String,
reason: String,
code: ErrorCode,
context: ErrorContext,
},
NumericalError {
operation: String,
details: String,
code: ErrorCode,
context: ErrorContext,
},
ModelError {
address: Option<Address>,
reason: String,
code: ErrorCode,
context: ErrorContext,
},
InferenceError {
algorithm: String,
reason: String,
code: ErrorCode,
context: ErrorContext,
},
TraceError {
operation: String,
address: Option<Address>,
reason: String,
code: ErrorCode,
context: ErrorContext,
},
TypeMismatch {
address: Address,
expected: String,
found: String,
code: ErrorCode,
context: ErrorContext,
},
}Expand description
Errors that can occur during probabilistic programming operations.
Variants§
InvalidParameters
Invalid distribution parameters
NumericalError
Numerical computation failed
ModelError
Model execution failed
InferenceError
Inference algorithm failed
TraceError
Trace manipulation error
Fields
context: ErrorContextTypeMismatch
Type mismatch in trace value
Implementations§
Source§impl FugueError
impl FugueError
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
Get the error category for high-level handling.
Sourcepub fn context(&self) -> &ErrorContext
pub fn context(&self) -> &ErrorContext
Get the error context for debugging.
Sourcepub fn is_validation_error(&self) -> bool
pub fn is_validation_error(&self) -> bool
Check if this error is caused by parameter validation issues.
Sourcepub fn is_numerical_error(&self) -> bool
pub fn is_numerical_error(&self) -> bool
Check if this error is caused by numerical computation issues.
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this error is recoverable (can be handled and retried).
Source§impl FugueError
impl FugueError
Sourcepub fn invalid_parameters(
distribution: impl Into<String>,
reason: impl Into<String>,
code: ErrorCode,
) -> Self
pub fn invalid_parameters( distribution: impl Into<String>, reason: impl Into<String>, code: ErrorCode, ) -> Self
Create an InvalidParameters error with enhanced context.
Sourcepub fn invalid_parameters_with_context(
distribution: impl Into<String>,
reason: impl Into<String>,
code: ErrorCode,
context: ErrorContext,
) -> Self
pub fn invalid_parameters_with_context( distribution: impl Into<String>, reason: impl Into<String>, code: ErrorCode, context: ErrorContext, ) -> Self
Create an InvalidParameters error with context.
Sourcepub fn numerical_error(
operation: impl Into<String>,
details: impl Into<String>,
code: ErrorCode,
) -> Self
pub fn numerical_error( operation: impl Into<String>, details: impl Into<String>, code: ErrorCode, ) -> Self
Create a NumericalError with enhanced context.
Sourcepub fn trace_error(
operation: impl Into<String>,
address: Option<Address>,
reason: impl Into<String>,
code: ErrorCode,
) -> Self
pub fn trace_error( operation: impl Into<String>, address: Option<Address>, reason: impl Into<String>, code: ErrorCode, ) -> Self
Create a TraceError with enhanced context.
Sourcepub fn type_mismatch(
address: Address,
expected: impl Into<String>,
found: impl Into<String>,
) -> Self
pub fn type_mismatch( address: Address, expected: impl Into<String>, found: impl Into<String>, ) -> Self
Create a TypeMismatch error with enhanced context.
Sourcepub fn with_context(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_context( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add context to an existing error.
Sourcepub fn with_source_location(self, file: impl Into<String>, line: u32) -> Self
pub fn with_source_location(self, file: impl Into<String>, line: u32) -> Self
Add source location to an existing error.
Trait Implementations§
Source§impl Clone for FugueError
impl Clone for FugueError
Source§fn clone(&self) -> FugueError
fn clone(&self) -> FugueError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FugueError
impl Debug for FugueError
Source§impl Display for FugueError
impl Display for FugueError
Source§impl Error for FugueError
impl Error for FugueError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<&str> for FugueError
Helper for converting string errors (common in examples).
impl From<&str> for FugueError
Helper for converting string errors (common in examples).
Source§impl From<ParseFloatError> for FugueError
Convert from standard library errors to FugueError.
impl From<ParseFloatError> for FugueError
Convert from standard library errors to FugueError.