bitsy_parser/
error.rs

1use std::fmt;
2
3#[derive(Debug, PartialEq)]
4pub enum NotFound {
5    Anything,
6    Avatar,
7    Room,
8    Sprite,
9    Tile,
10}
11
12impl fmt::Display for NotFound {
13    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14        write!(f,"Not found: {} data", match self {
15            NotFound::Anything => "game",
16            NotFound::Avatar   => "avatar",
17            NotFound::Room     => "room",
18            NotFound::Sprite   => "sprite",
19            NotFound::Tile     => "tile",
20        })
21    }
22}
23
24#[derive(Debug)]
25pub enum Error {
26    Colour,
27    Dialogue,
28    Ending,
29    Exit,
30    Font,
31    Game {
32        missing: NotFound,
33    },
34    Image,
35    Item,
36    Palette,
37    Position,
38    Room,
39    Sprite,
40    Text,
41    Tile,
42    Transition,
43    Variable,
44    Version,
45}
46
47impl fmt::Display for Error {
48    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
49        write!(f, "")
50    }
51}
52
53impl std::error::Error for Error {}