1#[derive(Debug, thiserror::Error)]
3pub enum Error {
4 #[error("I/O error: {0}")]
5 Io(#[from] std::io::Error),
6
7 #[error("invalid NetCDF magic bytes")]
8 InvalidMagic,
9
10 #[error("unsupported NetCDF format version {0}")]
11 UnsupportedVersion(u8),
12
13 #[error("variable not found: {0}")]
14 VariableNotFound(String),
15
16 #[error("dimension not found: {0}")]
17 DimensionNotFound(String),
18
19 #[error("attribute not found: {0}")]
20 AttributeNotFound(String),
21
22 #[error("group not found: {0}")]
23 GroupNotFound(String),
24
25 #[error("type mismatch: expected {expected}, got {actual}")]
26 TypeMismatch { expected: String, actual: String },
27
28 #[error("invalid data: {0}")]
29 InvalidData(String),
30
31 #[error("HDF5 error: {0}")]
32 #[cfg(feature = "netcdf4")]
33 Hdf5(#[from] hdf5_reader::error::Error),
34
35 #[error("NetCDF-4 support not enabled (enable 'netcdf4' feature)")]
36 Nc4NotEnabled,
37}
38
39pub type Result<T> = std::result::Result<T, Error>;