use crate::value::{error::QuantityError, *};
use miette::Diagnostic;
use thiserror::Error;
use microcad_lang_base::Identifier;
#[derive(Debug, Error, Diagnostic)]
pub enum ValueError {
#[error("Invalid operator: {0}")]
InvalidOperator(String),
#[error("Quantity error: {0}")]
QuantityError(#[from] QuantityError),
#[error("Cannot convert named tuple to color: {0}")]
CannotConvertToColor(String),
#[error("Cannot add unit to a value that has already a unit: {0}")]
CannotAddUnitToValueWithUnit(String),
#[error("Cannot convert value {0} to {1}")]
CannotConvert(String, String),
#[error("Cannot concat two vec with different types {0} and {1}")]
CannotCombineVecOfDifferentType(Type, Type),
#[error("Tuple type mismatch: lhs={lhs}, rhs={rhs}")]
TupleTypeMismatch {
lhs: Type,
rhs: Type,
},
#[error("Duplicate parameter: {0}")]
DuplicateParameter(Identifier),
#[error("Identifier not found: {0}")]
IdNotFound(Identifier),
#[error("Common type expected")]
CommonTypeExpected,
}