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
28
use image::ImageError;
use thiserror::Error;
use wgpu::{CreateSurfaceError, RequestDeviceError};
use winit::error::{EventLoopError, OsError};

#[derive(Debug, Error)]
pub enum MageError {
    #[error("unable to create event loop")]
    EventLoopError(#[from] EventLoopError),

    #[error("unable to open window")]
    WindowError(#[from] OsError),

    #[error("unable to create rendering surface")]
    CreateSurfaceError(#[from] CreateSurfaceError),

    #[error("unable to create GPU adapter")]
    BadAdapter,

    #[error("unable to create GPU device")]
    BadDevice(#[from] RequestDeviceError),

    #[error("unable to load font")]
    BadFont(#[from] ImageError),

    #[error("font image is invalid")]
    InvalidFontImage,
}