microcad_lang/value/
value_error.rs1use crate::value::{error::QuantityError, *};
7use thiserror::Error;
8
9#[derive(Debug, Error)]
11pub enum ValueError {
12 #[error("Invalid operator: {0}")]
14 InvalidOperator(String),
15
16 #[error("Quantity error: {0}")]
18 QuantityError(#[from] QuantityError),
19
20 #[error("Cannot convert named tuple to color: {0}")]
22 CannotConvertToColor(Box<Tuple>),
23
24 #[error("Cannot add unit to a value that has already a unit: {0}")]
26 CannotAddUnitToValueWithUnit(Value),
27
28 #[error("Cannot convert value {0} to {1}")]
30 CannotConvert(Value, String),
31
32 #[error("Cannot convert value into boolean: {0}")]
34 CannotConvertToBool(Value),
35
36 #[error("Cannot concat two vec with different types {0} and {1}")]
38 CannotCombineVecOfDifferentType(Type, Type),
39
40 #[error("Tuple type mismatch: lhs={lhs}, rhs={rhs}")]
42 TupleTypeMismatch {
43 lhs: Type,
45 rhs: Type,
47 },
48
49 #[error("Duplicate parameter: {0}")]
51 DuplicateParameter(Identifier),
52
53 #[error("Identifier not found: {0}")]
55 IdNotFound(Identifier),
56
57 #[error("Common type expected")]
59 CommonTypeExpected,
60}