use std::path::PathBuf;
use thiserror::Error;
use crate::format::FileFormat;
#[derive(Debug, Error)]
pub enum Med64Error {
#[error("I/O error while reading {path}: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("I/O error while writing {path}: {source}")]
WriteIo {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("unexpected end of file at offset {offset}")]
UnexpectedEof { offset: u64 },
#[error("invalid header in {path}: {message}")]
InvalidHeader { path: PathBuf, message: String },
#[error("invalid data block {block_index} in {path}: {message}")]
InvalidBlock { path: PathBuf, block_index: usize, message: String },
#[error("failed to parse moflo workflow {path}: {message}")]
InvalidMoflo { path: PathBuf, message: String },
#[error("unsupported conversion from {from:?} to {to:?}")]
UnsupportedConversion { from: FileFormat, to: FileFormat },
#[error("format {format:?} cannot be written")]
NotWritable { format: FileFormat },
#[error("invalid write: {message}")]
InvalidWrite { message: String },
}
pub type Result<T> = std::result::Result<T, Med64Error>;