ttmp-rs/src/error.rs

30 lines
1.0 KiB
Rust

use std::fs::File;
use std::io::BufWriter;
use thiserror::Error;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Error)]
pub enum Error {
#[error("error processing mod zip file")]
Zip(#[from] zip::result::ZipError),
#[error("io error reading/extracting mod")]
Io(#[from] std::io::Error),
#[error("invalid mod manifest")]
InvalidManifest(#[from] serde_json::Error),
#[error("the ttmp's data file was missing or corrupt")]
MissingDataFile(zip::result::ZipError),
#[error("the ttmp data file was corrupt")]
SqPackError(#[from] sqpack::binrw::Error),
#[error("error writing to output")]
BinRwWrite(sqpack::binrw::Error),
#[error("error parsing input")]
BinRwRead(sqpack::binrw::Error),
#[error("model files with edge geometry are not supported")]
EdgeGeometry,
#[error("a hash was missing during encoding - this is a bug")]
MissingHash,
#[error("error finalising writer")]
BufWriterIntoInner(#[from] std::io::IntoInnerError<BufWriter<File>>),
}