1pub type Result<T, E = Error> = std::result::Result<T, E>;
2
3#[derive(Error, Debug)]
4pub enum Error {
5 #[error(transparent)]
6 Io(#[from] std::io::Error),
7 #[error("Could not convert string to CP437")]
8 Cp437(codepage_437::Cp437Error),
9 #[error(transparent)]
10 Image(#[from] image::ImageError),
11 #[error("Image scale must be greater than 0 and less than or equal to 1")]
12 InvalidImageScale,
13 #[error("Character magnification must greater than 0 and less than or equal to 8")]
14 InvalidCharMagnification,
15 #[error("Spacing must be between 0 and 255 inclusive")]
16 InvalidSpacingParam,
17 #[error("Unsupported Markdown Tag: {:?}", _0)]
18 UnsupportedTag(pulldown_cmark::Tag<'static>),
19 #[error("Misaligned Markdown Tag: {:?}", _0)]
20 UnexpectedTag(pulldown_cmark::Tag<'static>),
21 #[error("Invalid rule tag: {}", _0)]
22 InvalidRuleTag(String),
23 #[error("Dangling direct child modifier '>'")]
24 DanglingDirectChild,
25 #[error("Empty rule string")]
26 EmptyRuleString,
27 #[error("Markdown Event unimplemented: {:?}", _0)]
28 MarkdownEventUnimplemented(pulldown_cmark::Event<'static>),
29}
30
31impl From<codepage_437::IntoCp437Error> for Error {
32 fn from(err: codepage_437::IntoCp437Error) -> Self {
33 err.cp437_error().into()
34 }
35}
36
37impl From<codepage_437::Cp437Error> for Error {
38 fn from(err: codepage_437::Cp437Error) -> Self {
39 Self::Cp437(err)
40 }
41}