bitsy-parser/src/error.rs

62 lines
1.0 KiB
Rust

use std::fmt;
#[derive(Debug, PartialEq)]
pub enum NotFound {
Anything,
Avatar,
Room,
Sprite,
Tile,
}
impl fmt::Display for NotFound {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f,"Not found: {} data", match self {
NotFound::Anything => "game",
NotFound::Avatar => "avatar",
NotFound::Room => "room",
NotFound::Sprite => "sprite",
NotFound::Tile => "tile",
})
}
}
#[derive(Debug)]
pub enum ImageError {
MalformedPixel,
WrongSize,
}
#[derive(Debug)]
pub enum Error {
Colour,
Dialogue,
Ending,
Exit,
Font,
Game {
missing: NotFound,
},
Image {
err: ImageError,
},
Item,
Palette,
Position,
Room,
Sprite,
Text,
Tile,
Transition,
Variable,
Version,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "")
}
}
impl std::error::Error for Error {}