microcad_lang/value/quantity/
error.rs

1// Copyright © 2025 The µcad authors <info@ucad.xyz>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4//! Quantity Error module
5
6use thiserror::Error;
7
8use crate::value::Quantity;
9
10/// Error when processing a [`Quantity`].
11#[derive(Debug, Error)]
12pub enum QuantityError {
13    /// Error adding two quantities.
14    #[error("Invalid operation: `{0}` {1} `{2}` (try `{2}` {1} `{0}`)")]
15    InvalidOperation(Quantity, char, Quantity),
16}
17
18/// Quality result type.
19pub type QuantityResult = Result<Quantity, QuantityError>;