waengine 1.7.4 → 1.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,335 @@
1
+ // 🆔 WAEngine Error Codes System
2
+ // Eindeutige Fehler-IDs für alle Fehlertypen
3
+
4
+ export const ERROR_CODES = {
5
+ // 1xxx - Connection Errors
6
+ CONNECTION: {
7
+ FAILED: 'WAE-1001',
8
+ TIMEOUT: 'WAE-1002',
9
+ LOST: 'WAE-1003',
10
+ SOCKET_ERROR: 'WAE-1004',
11
+ RECONNECT_FAILED: 'WAE-1005',
12
+ MAX_RETRIES: 'WAE-1006',
13
+ NETWORK_UNREACHABLE: 'WAE-1007',
14
+ DNS_FAILED: 'WAE-1008'
15
+ },
16
+
17
+ // 2xxx - Authentication Errors
18
+ AUTH: {
19
+ FAILED: 'WAE-2001',
20
+ SESSION_EXPIRED: 'WAE-2002',
21
+ SESSION_CORRUPTED: 'WAE-2003',
22
+ INVALID_CREDENTIALS: 'WAE-2004',
23
+ LOGOUT_DETECTED: 'WAE-2005',
24
+ CREDENTIALS_MISSING: 'WAE-2006',
25
+ LOGIN_REQUIRED: 'WAE-2007',
26
+ LOGOUT_FAILED: 'WAE-2008'
27
+ },
28
+
29
+ // 3xxx - File System Errors
30
+ FILE: {
31
+ NOT_FOUND: 'WAE-3001',
32
+ PERMISSION_DENIED: 'WAE-3002',
33
+ DISK_FULL: 'WAE-3003',
34
+ TOO_LARGE: 'WAE-3004',
35
+ INVALID_FORMAT: 'WAE-3005',
36
+ READ_ERROR: 'WAE-3006',
37
+ WRITE_ERROR: 'WAE-3007',
38
+ DELETE_ERROR: 'WAE-3008',
39
+ CORRUPTED: 'WAE-3009'
40
+ },
41
+
42
+ // 4xxx - Message Errors
43
+ MESSAGE: {
44
+ SEND_FAILED: 'WAE-4001',
45
+ INVALID_RECIPIENT: 'WAE-4002',
46
+ TOO_LONG: 'WAE-4003',
47
+ MEDIA_UPLOAD_FAILED: 'WAE-4004',
48
+ INVALID_FORMAT: 'WAE-4005',
49
+ RECEIVE_FAILED: 'WAE-4006',
50
+ MEDIA_DOWNLOAD_FAILED: 'WAE-4007',
51
+ MEDIA_TOO_LARGE: 'WAE-4008'
52
+ },
53
+
54
+ // 5xxx - Group Errors
55
+ GROUP: {
56
+ NOT_A_GROUP: 'WAE-5001',
57
+ NOT_ADMIN: 'WAE-5002',
58
+ USER_NOT_FOUND: 'WAE-5003',
59
+ NOT_FOUND: 'WAE-5004',
60
+ ACTION_RESTRICTED: 'WAE-5005',
61
+ PERMISSION_DENIED: 'WAE-5006',
62
+ INVALID_SETTINGS: 'WAE-5007'
63
+ },
64
+
65
+ // 6xxx - Media Errors
66
+ MEDIA: {
67
+ DOWNLOAD_FAILED: 'WAE-6001',
68
+ CONVERSION_FAILED: 'WAE-6002',
69
+ STICKER_CREATION_FAILED: 'WAE-6003',
70
+ INVALID_TYPE: 'WAE-6004',
71
+ TOO_LARGE: 'WAE-6005',
72
+ UPLOAD_FAILED: 'WAE-6006',
73
+ PROCESSING_FAILED: 'WAE-6007'
74
+ },
75
+
76
+ // 7xxx - Command Errors
77
+ COMMAND: {
78
+ NOT_FOUND: 'WAE-7001',
79
+ EXECUTION_FAILED: 'WAE-7002',
80
+ INVALID_ARGUMENTS: 'WAE-7003',
81
+ PERMISSION_DENIED: 'WAE-7004',
82
+ COOLDOWN_ACTIVE: 'WAE-7005',
83
+ DISABLED: 'WAE-7006'
84
+ },
85
+
86
+ // 8xxx - Plugin Errors
87
+ PLUGIN: {
88
+ LOAD_FAILED: 'WAE-8001',
89
+ NOT_FOUND: 'WAE-8002',
90
+ INVALID_CONFIG: 'WAE-8003',
91
+ DEPENDENCY_MISSING: 'WAE-8004',
92
+ VERSION_INCOMPATIBLE: 'WAE-8005',
93
+ INITIALIZATION_FAILED: 'WAE-8006',
94
+ EXECUTION_FAILED: 'WAE-8007'
95
+ },
96
+
97
+ // 9xxx - System Errors
98
+ SYSTEM: {
99
+ OUT_OF_MEMORY: 'WAE-9001',
100
+ PROCESS_CRASHED: 'WAE-9002',
101
+ UNKNOWN_ERROR: 'WAE-9003',
102
+ CONFIGURATION_INVALID: 'WAE-9004',
103
+ INITIALIZATION_FAILED: 'WAE-9005',
104
+ DEPENDENCY_MISSING: 'WAE-9006',
105
+ VERSION_MISMATCH: 'WAE-9007'
106
+ },
107
+
108
+ // 10xxx - QR Code Errors
109
+ QR: {
110
+ GENERATION_FAILED: 'WAE-10001',
111
+ DISPLAY_FAILED: 'WAE-10002',
112
+ SCAN_TIMEOUT: 'WAE-10003',
113
+ INVALID_DATA: 'WAE-10004',
114
+ BROWSER_OPEN_FAILED: 'WAE-10005',
115
+ TERMINAL_INCOMPATIBLE: 'WAE-10006'
116
+ },
117
+
118
+ // 11xxx - Mobile Support Errors
119
+ MOBILE: {
120
+ DETECTION_FAILED: 'WAE-11001',
121
+ PAIRING_FAILED: 'WAE-11002',
122
+ CODE_INVALID: 'WAE-11003',
123
+ NOT_SUPPORTED: 'WAE-11004',
124
+ TIMEOUT: 'WAE-11005'
125
+ },
126
+
127
+ // 12xxx - Recovery Errors
128
+ RECOVERY: {
129
+ FAILED: 'WAE-12001',
130
+ BACKUP_NOT_FOUND: 'WAE-12002',
131
+ BACKUP_CORRUPTED: 'WAE-12003',
132
+ RESTORE_FAILED: 'WAE-12004',
133
+ AUTO_BACKUP_FAILED: 'WAE-12005'
134
+ },
135
+
136
+ // 13xxx - Database Errors
137
+ DATABASE: {
138
+ CONNECTION_FAILED: 'WAE-13001',
139
+ QUERY_FAILED: 'WAE-13002',
140
+ MIGRATION_FAILED: 'WAE-13003',
141
+ DATA_CORRUPTED: 'WAE-13004',
142
+ TIMEOUT: 'WAE-13005'
143
+ },
144
+
145
+ // 14xxx - Network Errors
146
+ NETWORK: {
147
+ DNS_FAILED: 'WAE-14001',
148
+ PROXY_FAILED: 'WAE-14002',
149
+ SSL_ERROR: 'WAE-14003',
150
+ RATE_LIMITED: 'WAE-14004',
151
+ FIREWALL_BLOCKED: 'WAE-14005'
152
+ },
153
+
154
+ // 15xxx - Security Errors
155
+ SECURITY: {
156
+ UNAUTHORIZED: 'WAE-15001',
157
+ TOKEN_EXPIRED: 'WAE-15002',
158
+ INVALID_TOKEN: 'WAE-15003',
159
+ ACCESS_DENIED: 'WAE-15004',
160
+ ENCRYPTION_FAILED: 'WAE-15005'
161
+ }
162
+ };
163
+
164
+ // Error Code Descriptions (Deutsch)
165
+ const ErrorDescriptions = {
166
+ // 1xxx - Connection Errors
167
+ 'WAE-1001': 'Verbindung fehlgeschlagen',
168
+ 'WAE-1002': 'Verbindungs-Timeout',
169
+ 'WAE-1003': 'Verbindung verloren',
170
+ 'WAE-1004': 'Socket-Fehler',
171
+ 'WAE-1005': 'Wiederverbindung fehlgeschlagen',
172
+ 'WAE-1006': 'Maximale Wiederverbindungsversuche überschritten',
173
+ 'WAE-1007': 'Netzwerk nicht erreichbar',
174
+ 'WAE-1008': 'DNS-Auflösung fehlgeschlagen',
175
+
176
+ // 2xxx - Authentication Errors
177
+ 'WAE-2001': 'Authentifizierung fehlgeschlagen',
178
+ 'WAE-2002': 'Session abgelaufen',
179
+ 'WAE-2003': 'Session korrupt',
180
+ 'WAE-2004': 'Credentials ungültig',
181
+ 'WAE-2005': 'Logout erkannt',
182
+ 'WAE-2006': 'Credentials fehlen',
183
+ 'WAE-2007': 'Login erforderlich',
184
+ 'WAE-2008': 'Logout fehlgeschlagen',
185
+
186
+ // 3xxx - File System Errors
187
+ 'WAE-3001': 'Datei nicht gefunden',
188
+ 'WAE-3002': 'Zugriff verweigert',
189
+ 'WAE-3003': 'Festplatte voll',
190
+ 'WAE-3004': 'Datei zu groß',
191
+ 'WAE-3005': 'Dateiformat ungültig',
192
+ 'WAE-3006': 'Datei-Lesefehler',
193
+ 'WAE-3007': 'Datei-Schreibfehler',
194
+ 'WAE-3008': 'Datei-Löschfehler',
195
+ 'WAE-3009': 'Datei korrupt',
196
+
197
+ // 4xxx - Message Errors
198
+ 'WAE-4001': 'Nachricht senden fehlgeschlagen',
199
+ 'WAE-4002': 'Empfänger ungültig',
200
+ 'WAE-4003': 'Nachricht zu lang',
201
+ 'WAE-4004': 'Medien-Upload fehlgeschlagen',
202
+ 'WAE-4005': 'Nachrichtenformat ungültig',
203
+ 'WAE-4006': 'Nachricht empfangen fehlgeschlagen',
204
+ 'WAE-4007': 'Medien-Download fehlgeschlagen',
205
+ 'WAE-4008': 'Medien zu groß',
206
+
207
+ // 5xxx - Group Errors
208
+ 'WAE-5001': 'Keine Gruppe',
209
+ 'WAE-5002': 'Kein Admin',
210
+ 'WAE-5003': 'User nicht gefunden',
211
+ 'WAE-5004': 'Gruppe nicht gefunden',
212
+ 'WAE-5005': 'Aktion eingeschränkt',
213
+ 'WAE-5006': 'Gruppenberechtigung verweigert',
214
+ 'WAE-5007': 'Gruppeneinstellungen ungültig',
215
+
216
+ // 6xxx - Media Errors
217
+ 'WAE-6001': 'Media-Download fehlgeschlagen',
218
+ 'WAE-6002': 'Media-Konvertierung fehlgeschlagen',
219
+ 'WAE-6003': 'Sticker-Erstellung fehlgeschlagen',
220
+ 'WAE-6004': 'Media-Typ ungültig',
221
+ 'WAE-6005': 'Media zu groß',
222
+ 'WAE-6006': 'Media-Upload fehlgeschlagen',
223
+ 'WAE-6007': 'Media-Verarbeitung fehlgeschlagen',
224
+
225
+ // 7xxx - Command Errors
226
+ 'WAE-7001': 'Command nicht gefunden',
227
+ 'WAE-7002': 'Command-Ausführung fehlgeschlagen',
228
+ 'WAE-7003': 'Command-Argumente ungültig',
229
+ 'WAE-7004': 'Command-Berechtigung verweigert',
230
+ 'WAE-7005': 'Command-Cooldown aktiv',
231
+ 'WAE-7006': 'Command deaktiviert',
232
+
233
+ // 8xxx - Plugin Errors
234
+ 'WAE-8001': 'Plugin-Laden fehlgeschlagen',
235
+ 'WAE-8002': 'Plugin nicht gefunden',
236
+ 'WAE-8003': 'Plugin-Konfiguration ungültig',
237
+ 'WAE-8004': 'Plugin-Abhängigkeit fehlt',
238
+ 'WAE-8005': 'Plugin-Version inkompatibel',
239
+ 'WAE-8006': 'Plugin-Initialisierung fehlgeschlagen',
240
+ 'WAE-8007': 'Plugin-Ausführung fehlgeschlagen',
241
+
242
+ // 9xxx - System Errors
243
+ 'WAE-9001': 'Speicher voll',
244
+ 'WAE-9002': 'Prozess abgestürzt',
245
+ 'WAE-9003': 'Unbekannter Fehler',
246
+ 'WAE-9004': 'Konfiguration ungültig',
247
+ 'WAE-9005': 'Initialisierung fehlgeschlagen',
248
+ 'WAE-9006': 'Abhängigkeit fehlt',
249
+ 'WAE-9007': 'Versions-Konflikt',
250
+
251
+ // 10xxx - QR Code Errors
252
+ 'WAE-10001': 'QR-Code Generierung fehlgeschlagen',
253
+ 'WAE-10002': 'QR-Code Anzeige fehlgeschlagen',
254
+ 'WAE-10003': 'QR-Code Scan Timeout',
255
+ 'WAE-10004': 'QR-Daten ungültig',
256
+ 'WAE-10005': 'Browser-Öffnung fehlgeschlagen',
257
+ 'WAE-10006': 'Terminal inkompatibel',
258
+
259
+ // 11xxx - Mobile Support Errors
260
+ 'WAE-11001': 'Mobile-Erkennung fehlgeschlagen',
261
+ 'WAE-11002': 'Mobile-Pairing fehlgeschlagen',
262
+ 'WAE-11003': 'Pairing-Code ungültig',
263
+ 'WAE-11004': 'Mobile nicht unterstützt',
264
+ 'WAE-11005': 'Mobile-Timeout',
265
+
266
+ // 12xxx - Recovery Errors
267
+ 'WAE-12001': 'Recovery fehlgeschlagen',
268
+ 'WAE-12002': 'Backup nicht gefunden',
269
+ 'WAE-12003': 'Backup korrupt',
270
+ 'WAE-12004': 'Wiederherstellung fehlgeschlagen',
271
+ 'WAE-12005': 'Auto-Backup fehlgeschlagen',
272
+
273
+ // 13xxx - Database Errors
274
+ 'WAE-13001': 'Datenbankverbindung fehlgeschlagen',
275
+ 'WAE-13002': 'Datenbankabfrage fehlgeschlagen',
276
+ 'WAE-13003': 'Datenbank-Migration fehlgeschlagen',
277
+ 'WAE-13004': 'Daten korrupt',
278
+ 'WAE-13005': 'Datenbank-Timeout',
279
+
280
+ // 14xxx - Network Errors
281
+ 'WAE-14001': 'DNS fehlgeschlagen',
282
+ 'WAE-14002': 'Proxy fehlgeschlagen',
283
+ 'WAE-14003': 'SSL-Fehler',
284
+ 'WAE-14004': 'Rate-Limit erreicht',
285
+ 'WAE-14005': 'Firewall blockiert',
286
+
287
+ // 15xxx - Security Errors
288
+ 'WAE-15001': 'Nicht autorisiert',
289
+ 'WAE-15002': 'Token abgelaufen',
290
+ 'WAE-15003': 'Token ungültig',
291
+ 'WAE-15004': 'Zugriff verweigert',
292
+ 'WAE-15005': 'Verschlüsselung fehlgeschlagen'
293
+ };
294
+
295
+ // Get error description
296
+ export function getErrorDescription(errorCode) {
297
+ return ErrorDescriptions[errorCode] || 'Unbekannter Fehler';
298
+ }
299
+
300
+ // Create error with code
301
+ export function createError(errorCode, message, context = {}) {
302
+ const description = getErrorDescription(errorCode);
303
+ const error = new Error(message || description);
304
+ error.code = errorCode;
305
+ error.description = description;
306
+ error.context = context;
307
+ error.timestamp = Date.now();
308
+ return error;
309
+ }
310
+
311
+ // Check if error code exists
312
+ export function isValidErrorCode(errorCode) {
313
+ return errorCode in ErrorDescriptions;
314
+ }
315
+
316
+ // Get error category
317
+ export function getErrorCategory(errorCode) {
318
+ const code = parseInt(errorCode.split('-')[1]);
319
+ if (code >= 1000 && code < 2000) return 'Connection';
320
+ if (code >= 2000 && code < 3000) return 'Authentication';
321
+ if (code >= 3000 && code < 4000) return 'File System';
322
+ if (code >= 4000 && code < 5000) return 'Message';
323
+ if (code >= 5000 && code < 6000) return 'Group';
324
+ if (code >= 6000 && code < 7000) return 'Media';
325
+ if (code >= 7000 && code < 8000) return 'Command';
326
+ if (code >= 8000 && code < 9000) return 'Plugin';
327
+ if (code >= 9000 && code < 10000) return 'System';
328
+ if (code >= 10000 && code < 11000) return 'QR Code';
329
+ if (code >= 11000 && code < 12000) return 'Mobile';
330
+ if (code >= 12000 && code < 13000) return 'Recovery';
331
+ if (code >= 13000 && code < 14000) return 'Database';
332
+ if (code >= 14000 && code < 15000) return 'Network';
333
+ if (code >= 15000 && code < 16000) return 'Security';
334
+ return 'Unknown';
335
+ }