microcad_lang/value/
value_error.rs1use crate::value::{error::QuantityError, *};
7use miette::Diagnostic;
8use thiserror::Error;
9
10use microcad_lang_base::Identifier;
11
12#[derive(Debug, Error, Diagnostic)]
14pub enum ValueError {
15 #[error("Invalid operator: {0}")]
17 InvalidOperator(String),
18
19 #[error("Quantity error: {0}")]
21 QuantityError(#[from] QuantityError),
22
23 #[error("Cannot convert named tuple to color: {0}")]
25 CannotConvertToColor(String),
26
27 #[error("Cannot add unit to a value that has already a unit: {0}")]
29 CannotAddUnitToValueWithUnit(String),
30
31 #[error("Cannot convert value {0} to {1}")]
33 CannotConvert(String, String),
34
35 #[error("Cannot concat two vec with different types {0} and {1}")]
37 CannotCombineVecOfDifferentType(Type, Type),
38
39 #[error("Tuple type mismatch: lhs={lhs}, rhs={rhs}")]
41 TupleTypeMismatch {
42 lhs: Type,
44 rhs: Type,
46 },
47
48 #[error("Duplicate parameter: {0}")]
50 DuplicateParameter(Identifier),
51
52 #[error("Identifier not found: {0}")]
54 IdNotFound(Identifier),
55
56 #[error("Common type expected")]
58 CommonTypeExpected,
59}