//! Crate error type.
use std::fmt;
/// Recoverable failure from layout, lens, or encode.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
/// Grid has no columns or a row width that does not match the schema.
InvalidGrid(&'static str),
/// Requested layout is reserved but not implemented.
UnsupportedLayout(&'static str),
/// PNG / pixmap dimensions are unusable.
Raster(&'static str),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidGrid(msg) => write!(f, "invalid grid: {msg}"),
Self::UnsupportedLayout(name) => write!(f, "unsupported layout: {name}"),
Self::Raster(msg) => write!(f, "raster: {msg}"),
}
}
}
impl std::error::Error for Error {}