glyphs_reader/
error.rs

1use std::{io, num::TryFromIntError, path::PathBuf};
2
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum Error {
7    #[error("IO failure")]
8    IoError(#[from] io::Error),
9    #[error("Unable to parse {0}: {1}")]
10    ParseError(PathBuf, String),
11    #[error("Unexpected file structure {0}")]
12    StructuralError(String),
13    #[error("No upem")]
14    NoUnitsPerEm,
15    #[error("Invalid upem")]
16    InvalidUpem(#[from] TryFromIntError),
17    #[error("Unrecognized name {0}")]
18    UnknownValueName(String),
19    #[error("Not a .glyphspackage directory: {0}")]
20    NotAGlyphsPackage(PathBuf),
21    #[error("Invalid plist")]
22    WorstPlistEver(#[from] crate::plist::Error),
23    #[error("Invalid code page {0}")]
24    InvalidCodePage(u32),
25    #[error("{value} expected to be between {lbound} and {ubound}")]
26    ProductionNameOutOfBounds {
27        value: u32,
28        lbound: u32,
29        ubound: u32,
30    },
31}