Skip to main content

cmtool_core/
errors.rs

1// SPDX-License-Identifier: GPL-3.0-or-later
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum ModelError {
7    #[error("Cell to cell divergence higher than tolerance: {0}>{1}")]
8    CellToCellDivergence(f64, f64),
9
10    #[error("Resulting flow has invalid value ")]
11    InvalidFlow,
12
13    #[error("Resulting flow is empty: the velocity field carries no data")]
14    EmptyFlow,
15}
16
17#[derive(Error, Debug)]
18pub enum CoreError {
19    #[error("Cmtool: {0}")]
20    Data(#[from] cmtool_data::DataError),
21
22    #[error("Cmtool: {0}")]
23    Custom(String),
24
25    #[error("Handle")]
26    Handle,
27
28    #[error("Error writing/reading file: {0}")]
29    IO(#[from] std::io::Error),
30
31    #[error("Model: {0}")]
32    Model(#[from] ModelError),
33}