1#[derive(thiserror::Error, Debug)]
3pub enum ParserError {
4 #[error(transparent)]
5 ProtobufDecode(#[from] crate::proto::prost::DecodeError),
6
7 #[error(transparent)]
8 UnknownEnumValue(#[from] crate::proto::prost::UnknownEnumValue),
9
10 #[error(transparent)]
11 SnapDecompress(#[from] snap::Error),
12
13 #[error(transparent)]
14 StringTable(#[from] StringTableError),
15
16 #[error(transparent)]
17 Class(#[from] ClassError),
18
19 #[error(transparent)]
20 Entity(#[from] EntityError),
21
22 #[error(transparent)]
23 FieldValue(#[from] FieldValueError),
24
25 #[error(transparent)]
26 GameEvent(#[from] GameEventError),
27
28 #[error(transparent)]
29 ObserverError(#[from] anyhow::Error),
30
31 #[error("Wrong CDemoFileInfo offset")]
32 ReplayEncodingError,
33
34 #[error("Supports only Source 2 replays")]
35 WrongMagic,
36
37 #[error("IO error: {0}")]
38 IoError(String),
39
40 #[cfg(feature = "dota")]
41 #[error(transparent)]
42 CombatLog(#[from] CombatLogError),
43
44 #[cfg(feature = "deadlock")]
45 #[error("CCitadelUserMsgPostMatchDetails not found")]
46 MatchDetailsNotFound,
47}
48
49#[derive(thiserror::Error, Debug)]
50pub enum ClassError {
51 #[error("Class not found for the given id {0}")]
52 ClassNotFoundById(i32),
53
54 #[error("Class not found for the given name {0}")]
55 ClassNotFoundByName(String),
56}
57
58#[derive(thiserror::Error, Debug)]
59pub enum EntityError {
60 #[error("No entities found at index {0}")]
61 IndexNotFound(usize),
62
63 #[error("No entities found for handle {0}")]
64 HandleNotFound(usize),
65
66 #[error("No entities found for class with id {0}")]
67 ClassIdNotFound(i32),
68
69 #[error("No entities found for class with name {0}")]
70 ClassNameNotFound(String),
71
72 #[error("No property found for name {0} (Class: {1}, FieldPath: {2})")]
73 PropertyNameNotFound(String, String, String),
74
75 #[error(transparent)]
76 FieldPathNotFound(#[from] SerializerError),
77}
78
79#[derive(thiserror::Error, Debug)]
80pub enum FieldValueError {
81 #[error("Cannot convert {0} into {1}")]
82 ConversionError(String, String),
83}
84
85#[derive(thiserror::Error, Debug)]
86pub enum GameEventError {
87 #[error("Unknown key: {0}")]
88 UnknownKey(String),
89 #[error("Conversion error: {0} -> {1}")]
90 ConversionError(String, String),
91}
92
93#[derive(thiserror::Error, Debug)]
94pub enum SerializerError {
95 #[error("No field path for given name {0}")]
96 NoFieldPath(String),
97}
98
99#[derive(thiserror::Error, Debug)]
100pub enum StringTableError {
101 #[error("String table not found for the given id {0}")]
102 TableNotFoundById(i32),
103
104 #[error("String table not found for the given name {0}")]
105 TableNotFoundByName(String),
106
107 #[error("String table entry not found for the given index {0} ({1})")]
108 RowNotFoundByIndex(i32, String),
109}
110
111#[derive(thiserror::Error, Debug)]
112pub enum CombatLogError {
113 #[error("No {0} for {1}")]
114 EmptyProperty(String, String),
115 #[error("No {0} for {1}")]
116 EmptyName(String, String),
117}