use quick_error::quick_error;
use std::io::Error as IOError;
quick_error! {
#[derive(Debug)]
pub enum NeuroformatsError {
InvalidCurvFormat {
display("Invalid Curv file")
}
VertexColorCountMismatch {
display("Invalid number of vertex colors for the mesh")
}
InvalidFsSurfaceFormat {
display("Invalid FreeSurfer surf file")
}
InvalidFsLabelFormat {
display("Invalid FreeSurfer label file")
}
InvalidWavefrontObjectFormat {
display("Invalid Wavefront Object format file or unsupported dialect")
}
UnsupportedFsAnnotFormatVersion {
display("Unsupported FreeSurfer annot file format version")
}
EmptyWavefrontObjectFile {
display("The Wavefront Object mesh file does not contain a mesh")
}
InvalidFsMghFormat {
display("Invalid FreeSurfer MGH file")
}
UnsupportedMriDataTypeInMgh {
display("Invalid or unsupported MRI_DTYPE")
}
NoRasInformationInHeader {
display("The MGH header does not contain valid RAS information.")
}
AllocationTooLarge {
display("Requested allocation exceeds maximum allowed size. Increase the limit with neuroformats::set_max_bytes_per_file() if the file is legitimate.")
}
InvalidHeaderValue(msg: String) {
display("Invalid header value: {}", msg)
}
IntegerOverflow {
display("Integer overflow when computing allocation size from header dimensions")
}
StringTooLong {
display("Variable-length string exceeds the configured maximum length")
}
InvalidVertexValue(msg: String) {
display("Invalid vertex value: {}", msg)
}
RegionNotFound(region: String) {
display("Region '{}' not found in annotation", region)
}
InvalidNiftiFormat(msg: String) {
display("Invalid NIfTI-1 file: {}", msg)
}
UnsupportedNiftiDataType(dtype: i16) {
display("Unsupported NIfTI-1 data type: {}. Supported types are UINT8 (2), INT16 (4), INT32 (8), FLOAT32 (16).", dtype)
}
Io(err: IOError) {
from()
source(err)
}
}
}
pub type Result<T> = ::std::result::Result<T, NeuroformatsError>;