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: {0}, rhs: {1})")]
TimestampMismatch(f64, f64),
#[error("requested timestamp {0} is outside the covered range [{1}, {2}]")]
TimestampOutOfRange(f64, f64, f64),
#[error("cannot multiply transforms with the same frame")]
SameFrameMultiplication,
#[error("frames do not have a parent-child relationship")]
IncompatibleFrames,
#[error("transform not found from {0} to {1}")]
NotFound(String, String),
#[error("transform tree is empty")]
TransformTreeEmpty,
#[error("timestamp error: {0}")]
TimestampError(#[from] TimeError),
#[error("quaternion error: {0}")]
QuaternionError(#[from] QuaternionError),
}