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 #[cfg(feature = "dota")]
38 #[error(transparent)]
39 CombatLog(#[from] CombatLogError),
40
41 #[cfg(feature = "deadlock")]
42 #[error("CCitadelUserMsgPostMatchDetails not found")]
43 MatchDetailsNotFound,
44}
45
46#[derive(thiserror::Error, Debug)]
47pub enum ClassError {
48 #[error("Class not found for the given id {0}")]
49 ClassNotFoundById(i32),
50
51 #[error("Class not found for the given name {0}")]
52 ClassNotFoundByName(String),
53}
54
55#[derive(thiserror::Error, Debug)]
56pub enum EntityError {
57 #[error("No entities found at index {0}")]
58 IndexNotFound(usize),
59
60 #[error("No entities found for handle {0}")]
61 HandleNotFound(usize),
62
63 #[error("No entities found for class with id {0}")]
64 ClassIdNotFound(i32),
65
66 #[error("No entities found for class with name {0}")]
67 ClassNameNotFound(String),
68
69 #[error("No property found for name {0} (Class: {1}, FieldPath: {2})")]
70 PropertyNameNotFound(String, String, String),
71
72 #[error(transparent)]
73 FieldPathNotFound(#[from] SerializerError),
74}
75
76#[derive(thiserror::Error, Debug)]
77pub enum FieldValueError {
78 #[error("Cannot convert {0} into {1}")]
79 ConversionError(String, String),
80}
81
82#[derive(thiserror::Error, Debug)]
83pub enum GameEventError {
84 #[error("Unknown key: {0}")]
85 UnknownKey(String),
86 #[error("Conversion error: {0} -> {1}")]
87 ConversionError(String, String),
88}
89
90#[derive(thiserror::Error, Debug)]
91pub enum SerializerError {
92 #[error("No field path for given name {0}")]
93 NoFieldPath(String),
94}
95
96#[derive(thiserror::Error, Debug)]
97pub enum StringTableError {
98 #[error("String table not found for the given id {0}")]
99 TableNotFoundById(i32),
100
101 #[error("String table not found for the given name {0}")]
102 TableNotFoundByName(String),
103
104 #[error("String table entry not found for the given index {0} ({1})")]
105 RowNotFoundByIndex(i32, String),
106}
107
108#[derive(thiserror::Error, Debug)]
109pub enum CombatLogError {
110 #[error("No {0} for {1}")]
111 EmptyProperty(String, String),
112 #[error("No {0} for {1}")]
113 EmptyName(String, String),
114}