Skip to main content

cmtool_assemble/
errors.rs

1// SPDX-License-Identifier: GPL-3.0-or-later
2
3use std::io;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum CMError {
8    #[error("Cmtool encountered an unknown error. Please check the input and try again.")]
9    Default,
10
11    #[error("Cmtool error: {0}")]
12    Custom(String),
13
14    ///Wrapped by the caller, which knows the reactor the descriptor belongs to
15    #[error("Invalid descriptor: {0}")]
16    Descriptor(String),
17
18    #[error(
19        "Cmtool: Mass balance error in PFR '{0}' with phase {1}. Check your inputs or calculations."
20    )]
21    MassBalance(String, String),
22
23    #[error("Cmtool data error: {0}. Ensure your data files are correct and accessible.")]
24    Data(#[from] cmtool_data::DataError),
25
26    #[error("I/O error: Failed to handle the file '{0}'. Check file path and permissions.")]
27    IO(#[from] io::Error),
28
29    #[error(
30        "Cmtool parse error: {0}. Verify that the XML input is well-formed and matches expected schema."
31    )]
32    Parse(#[from] serde_xml_rs::Error),
33}