dcss_scenario_builder/
scenario_errors.rs1use dcss_api::Error as APIError;
2use thiserror::Error;
3
4#[derive(Error)]
6pub enum Error {
7 #[error(transparent)]
8 APIError(#[from] Box<APIError>),
9 #[error(transparent)]
10 IOError(#[from] std::io::Error),
11 #[error(transparent)]
12 YamlError(#[from] serde_yaml::Error),
13 #[error("DCSS Parsing Error: {0}")]
14 YamlParsingError(#[from] YamlParsingError),
15 #[error("DCSS Lua error: {0}")]
16 LuaError(String),
17}
18
19impl std::fmt::Debug for Error {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 write!(f, "{self}")?;
22 Ok(())
23 }
24}
25
26#[derive(Error, Debug)]
28pub enum YamlParsingError {
29 #[error("Branch `{0}` does not exist.")]
30 UnknownBranch(String),
31 #[error("Missing `@` on `D:1` in the yaml.")]
32 MissingChar,
33 #[error("Maximum width of map is 79 columns.")]
34 MapTooWide,
35 #[error("Maximum height of map is 69 rows.")]
36 MapTooLong,
37}