1use scirs2_core::error::CoreError;
6use thiserror::Error;
7
8#[derive(Error, Debug)]
10pub enum NdimageError {
11 #[error("Invalid input: {0}")]
13 InvalidInput(String),
14
15 #[error("Dimension mismatch: {0}")]
17 DimensionError(String),
18
19 #[error("Implementation error: {0}")]
21 ImplementationError(String),
22
23 #[error("Computation error: {0}")]
25 ComputationError(String),
26
27 #[error("Filter error: {0}")]
29 FilterError(String),
30
31 #[error("Interpolation error: {0}")]
33 InterpolationError(String),
34
35 #[error("Measurement error: {0}")]
37 MeasurementError(String),
38
39 #[error("Morphology error: {0}")]
41 MorphologyError(String),
42
43 #[error("Not implemented: {0}")]
45 NotImplementedError(String),
46
47 #[error("Processing error: {0}")]
49 ProcessingError(String),
50
51 #[error("{0}")]
53 CoreError(#[from] CoreError),
54
55 #[error("IO error: {0}")]
57 IoError(#[from] std::io::Error),
58
59 #[error("Shape error: {0}")]
61 ShapeError(#[from] scirs2_core::ndarray::ShapeError),
62
63 #[error("Format error: {0}")]
65 FormatError(#[from] std::fmt::Error),
66
67 #[error("GPU not available: {0}")]
69 GpuNotAvailable(String),
70
71 #[error("Configuration error: {0}")]
73 ConfigurationError(String),
74
75 #[error("Memory error: {0}")]
77 MemoryError(String),
78
79 #[error("Error: {0}")]
81 Other(String),
82}
83
84pub type NdimageResult<T> = std::result::Result<T, NdimageError>;