use alloc::string::String;
use thiserror::Error;
use crate::errors::{QuaternionError, TimeError};
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum TransformError {
#[error("rotation is not a unit quaternion (norm: {0})")]
NonUnitRotation(f64),
#[error("transform contains non-finite values")]
NonFiniteValues,
#[error("transform timestamps do not match (lhs: {lhs}, rhs: {rhs})")]
TimestampMismatch {
lhs: f64,
rhs: f64,
},
#[error("static transforms cannot be interpolation endpoints")]
StaticInterpolation,
#[error("requested timestamp {requested} is outside the covered range [{start}, {end}]")]
TimestampOutOfRange {
requested: f64,
start: f64,
end: f64,
},
#[error("cannot multiply transforms that both describe child frame {frame}")]
SameFrameMultiplication {
frame: String,
},
#[error("frames do not have a parent-child relationship (expected {expected}, found {found})")]
IncompatibleFrames {
expected: String,
found: String,
},
#[error("timestamp error: {0}")]
TimestampError(#[from] TimeError),
#[error("quaternion error: {0}")]
QuaternionError(#[from] QuaternionError),
}