pbrt/shared/src/utils/error.rs
2026-01-18 16:29:27 +00:00

36 lines
883 B
Rust

use std::fmt;
use std::sync::Arc;
#[derive(Debug)]
pub enum LlsError {
SingularMatrix,
}
impl std::error::Error for LlsError {}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum InversionError {
SingularMatrix,
EmptyMatrix,
}
impl fmt::Display for LlsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
LlsError::SingularMatrix => write!(f, "Matrix is singular and cannot be inverted."),
}
}
}
impl fmt::Display for InversionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
InversionError::SingularMatrix => {
write!(f, "Matrix is singular and cannot be inverted.")
}
InversionError::EmptyMatrix => write!(f, "Matrix is empty and cannot be inverted."),
}
}
}
impl std::error::Error for InversionError {}