use thiserror::Error;
#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum ParseError {
#[error("truncated: need {needed} bytes from the start of the file")]
Truncated { needed: usize },
#[error("bad magic: not a tilepack file")]
BadMagic,
#[error("unsupported version {found} (this reader speaks {supported})")]
BadVersion { found: u8, supported: u8 },
#[error("invalid face_count {0}: must be 1 or 6")]
BadFaceCount(u8),
#[error("inconsistent header: {0}")]
Inconsistent(&'static str),
#[error("bad tile index: {0}")]
BadIndex(&'static str),
}
#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum WriteError {
#[error("invalid parameter: {0}")]
InvalidParams(&'static str),
#[error("tile out of range: {0}")]
TileOutOfRange(&'static str),
}