pub enum FugueError {
InvalidParameters {
distribution: String,
reason: String,
code: ErrorCode,
context: ErrorContext,
},
ModelError {
address: Option<Address>,
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.
Every variant is constructed by real logic in the crate (FG-33): the
speculative NumericalError and InferenceError variants were removed
because nothing produced them — see the module-level docs.
Variants§
InvalidParameters
Invalid distribution parameters
ModelError
Model execution 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 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.
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.
Trait Implementations§
Source§impl Clone for FugueError
impl Clone for FugueError
Source§fn clone(&self) -> FugueError
fn clone(&self) -> FugueError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for FugueError
impl RefUnwindSafe for FugueError
impl Send for FugueError
impl Sync for FugueError
impl Unpin for FugueError
impl UnsafeUnpin for FugueError
impl UnwindSafe for FugueError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more