Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
errormodulehandler.c
Go to the documentation of this file.
1 
5 {
6  Unknown/* = -1*/,
19 };
20 
29 {
43  static proto int ThrowError(ErrorCategory category, int code, string additionalInfo = "");
44 
57  static proto int ThrowErrorCode(int errorCode, string additionalInfo = "");
58 
71  static proto int CreateError(ErrorCategory category, int code);
72 
84  static proto ErrorCategory GetCategoryFromError(int errorCode);
85 
97  static proto int GetCodeFromError(int errorCode);
98 
110  static proto owned string GetErrorHex(int errorCode);
111 
112 
113 
120  static proto bool AddModule(ErrorCategory category, notnull ErrorHandlerModule errorModule);
121 
127  static proto bool RemoveModule(ErrorCategory category);
128 
129 
130 
138  static proto string GetClientMessage(ErrorCategory category, int code, string additionalInfo = "");
139 
146  static proto string GetClientMessageByCode(int errorCode, string additionalInfo = "");
147 
154  static proto string GetLastClientMessage(ErrorCategory category, int code);
155 
161  static proto string GetLastClientMessageByCode(int errorCode);
162 
170  static proto string GetServerMessage(ErrorCategory category, int code, string additionalInfo = "");
171 
178  static proto string GetServerMessageByCode(int errorCode, string additionalInfo = "");
179 
186  static proto string GetLastServerMessage(ErrorCategory category, int code);
187 
193  static proto string GetLastServerMessageByCode(int errorCode);
194 
195 
196 
201  static proto native ErrorModuleHandler GetInstance();
202 
203  static proto void GetErrorModules(notnull out array<ErrorHandlerModule> errorModules);
204 
205 
206 
211  void SafeAddModule(notnull ErrorHandlerModule errorModule)
212  {
213  if ( !AddModule(errorModule.GetCategory(), errorModule) )
214  Error(string.Format("[EMH] Adding %1 failed. (Category: %2)", errorModule, errorModule.GetCategory()));
215  }
216 
221  void SafeRemoveModule(notnull ErrorHandlerModule errorModule)
222  {
223  if ( !RemoveModule(errorModule.GetCategory()) )
224  Error(string.Format("[EMH] Removing %1 failed. (Category: %2)", errorModule, errorModule.GetCategory()));
225  }
226 
231  void SafeRemoveModule(ErrorCategory category)
232  {
233  if ( !RemoveModule(category) )
234  Error(string.Format("[EMH] Removing %1 failed.", category));
235  }
236 
240  private void Init()
241  {
242  if (!g_Game.IsDedicatedServer())
243  {
244  SafeAddModule(new ConnectErrorClientModule);
245  SafeAddModule(new ConnectErrorServerModule);
246  SafeAddModule(new ConnectErrorScriptModule);
247  }
248  SafeAddModule(new ClientKickedModule);
249  SafeAddModule(new BIOSErrorModule);
250  }
251 
255  void OnEvent(EventType eventTypeId, Param params)
256  {
258  GetErrorModules(errorModules);
259 
260  foreach (ErrorHandlerModule module : errorModules)
261  {
262  module.OnEvent(eventTypeId, params);
263  }
264  }
265 }
Error
void Error(string err)
Messagebox with error message.
Definition: endebug.c:90
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
ConnectErrorServer
@ ConnectErrorServer
Error group for when the Client did connect to the Server, but the server rejected the connection.
Definition: errormodulehandler.c:12
ClientKicked
@ ClientKicked
Error group for when Client is kicked from server.
Definition: errormodulehandler.c:16
ErrorCategory
ErrorCategory
ErrorCategory - To decide what ErrorHandlerModule needs to be called and easily identify where it cam...
Definition: errormodulehandler.c:4
ConnectErrorClient
@ ConnectErrorClient
Error group for when something went wrong while trying to connect to the server.
Definition: errormodulehandler.c:10
EventType
TypeID EventType
Definition: enwidgets.c:55
BIOSError
@ BIOSError
Error group for BIOS errors.
Definition: errormodulehandler.c:18
BIOSErrorModule
Definition: bioserrormodule.c:62
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
Unknown
@ Unknown
Definition: errormodulehandler.c:6
ConnectErrorServerModule
Definition: connecterrorservermodule.c:34
Generic
@ Generic
Generic error group.
Definition: errormodulehandler.c:8
ConnectErrorScript
@ ConnectErrorScript
Error group for connect errors thrown from Script.
Definition: errormodulehandler.c:14
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition: isboxcollidinggeometryproxyclasses.c:27
ConnectErrorClientModule
Definition: connecterrorclientmodule.c:23
ClientKickedModule
Definition: clientkickedmodule.c:174
ErrorHandlerModule
Definition and API of an ErrorHandlerModule - Do not insert any logic here! (as this class is not mod...
Definition: errorhandlermodule.c:5
ConnectErrorScriptModule
enum EConnectErrorServer ConnectErrorScriptModule
ErrorModuleHandler
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
Definition: errormodulehandler.c:28