Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
errormodulehandler.c
Go to the documentation of this file.
1
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}
Definition and API of an ErrorHandlerModule - Do not insert any logic here! (as this class is not mod...
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
enum EConnectErrorScript ConnectErrorScriptModule()
DayZGame g_Game
Definition dayzgame.c:3868
ErrorCategory
ErrorCategory - To decide what ErrorHandlerModule needs to be called and easily identify where it cam...
@ ConnectErrorServer
Error group for when the Client did connect to the Server, but the server rejected the connection.
@ ConnectErrorClient
Error group for when something went wrong while trying to connect to the server.
@ Unknown
@ ConnectErrorScript
Error group for connect errors thrown from Script.
@ Generic
Generic error group.
@ BIOSError
Error group for BIOS errors.
@ ClientKicked
Error group for when Client is kicked from server.
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
TypeID EventType
Definition enwidgets.c:55