concision_neural/
error.rs

1/*
2    Appellation: error <module>
3    Contrib: @FL03
4*/
5
6/// a type alias for a [Result] with a [NeuralError]
7pub type NeuralResult<T = ()> = core::result::Result<T, NeuralError>;
8
9#[derive(Debug, scsys_derive::VariantConstructors, thiserror::Error)]
10pub enum NeuralError {
11    #[error("Invalid Batch Size")]
12    InvalidBatchSize,
13    #[error("Invalid Input Shape")]
14    InvalidInputShape,
15    #[error("Invalid Output Shape")]
16    InvalidOutputShape,
17    #[cfg(feature = "std")]
18    #[error("Parameter Error")]
19    ParameterError(String),
20    #[error("Training Failed")]
21    TrainingFailed,
22    #[error(transparent)]
23    TrainingError(#[from] TrainingError),
24    #[cfg(feature = "anyhow")]
25    #[error(transparent)]
26    AnyError(#[from] anyhow::Error),
27    #[cfg(feature = "std")]
28    #[error(transparent)]
29    BoxError(#[from] Box<dyn core::error::Error + Send + Sync>),
30    #[error(transparent)]
31    CoreError(#[from] concision_core::error::Error),
32    #[error(transparent)]
33    FmtError(#[from] core::fmt::Error),
34    #[cfg(feature = "std")]
35    #[error(transparent)]
36    IOError(#[from] std::io::Error),
37    #[cfg(feature = "std")]
38    #[error("Unknown Error: {0}")]
39    UnknownError(String),
40}
41
42#[derive(Debug, scsys_derive::VariantConstructors, thiserror::Error)]
43pub enum TrainingError {
44    #[error("Invalid Training Data")]
45    InvalidTrainingData,
46    #[error("Training Failed")]
47    TrainingFailed,
48    #[error(transparent)]
49    CoreError(#[from] concision_core::error::Error),
50}