neuroformats/
error.rs

1//! Errors one may encounter when using neuroformats.
2
3use quick_error::quick_error;
4use std::io::Error as IOError;
5
6quick_error! {
7    /// Error type for all error variants originated by this crate.
8    #[derive(Debug)]
9    pub enum NeuroformatsError {
10        /// Invalid curv file: wrong magic number.
11        InvalidCurvFormat {
12            display("Invalid Curv file")
13        }
14
15        VertexColorCountMismatch {
16            display("Invalid number of vertex colors for the mesh")
17        }
18
19        InvalidFsSurfaceFormat {
20            display("Invalid FreeSurfer surf file")
21        }
22
23        InvalidFsLabelFormat {
24            display("Invalid FreeSurfer label file")
25        }
26
27        InvalidWavefrontObjectFormat {
28            display("Invalid Wavefront Object format file or unsupported dialect")
29        }
30
31        UnsupportedFsAnnotFormatVersion {
32            display("Unsupported FreeSurfer annot file format version")
33        }
34
35        EmptyWavefrontObjectFile {
36            display("The Wavefront Object mesh file does not contain a mesh")
37        }
38
39        InvalidFsMghFormat {
40            display("Invalid FreeSurfer MGH file")
41        }
42
43        UnsupportedMriDataTypeInMgh {
44            display("Invalid or unsupported MRI_DTYPE")
45        }
46
47        NoRasInformationInHeader {
48            display("The MGH header does not contain valid RAS information.")
49        }
50
51        /// I/O Error
52        Io(err: IOError) {
53            from()
54            source(err)
55        }
56    }
57}
58
59/// Alias type for results originated from this crate.
60pub type Result<T> = ::std::result::Result<T, NeuroformatsError>;