wowlab_parsers/parsers/simc/
errors.rs1wowlab_engine_macros::define_error! {
2#[derive(Debug)]
4pub struct SimcParseError {
5 kind: SimcParseErrorKind,
6}
7
8#[derive(Debug, thiserror::Error)]
9enum SimcParseErrorKind {
10 #[error("Invalid token at byte {position}")]
11 InvalidToken { position: usize },
12
13 #[error("Missing class definition (e.g., warrior=\"CharName\")")]
14 MissingClass,
15
16 #[error("Missing character name")]
17 MissingName,
18}
19}
20
21impl SimcParseError {
22 pub(super) const fn invalid_token(position: usize) -> Self {
23 Self {
24 kind: SimcParseErrorKind::InvalidToken { position },
25 }
26 }
27
28 pub(super) const fn missing_class() -> Self {
29 Self {
30 kind: SimcParseErrorKind::MissingClass,
31 }
32 }
33
34 pub(super) const fn missing_name() -> Self {
35 Self {
36 kind: SimcParseErrorKind::MissingName,
37 }
38 }
39}