1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::*;

use thiserror::Error;

#[derive(Debug, Error)]
pub enum FontError {
    #[error("Image Error")]
    ImageError(riddle_image::ImageError),

    #[error("Failed to parse font")]
    FontParseFailed,

    #[error(transparent)]
    CommonError(#[from] CommonError),
}

impl From<riddle_image::ImageError> for FontError {
    fn from(e: riddle_image::ImageError) -> Self {
        FontError::ImageError(e)
    }
}

impl From<std::io::Error> for FontError {
    fn from(err: std::io::Error) -> Self {
        FontError::CommonError(CommonError::IOError(err))
    }
}