opticore-catch-exception-error 1.0.13 → 1.0.15

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.
package/dist/index.js CHANGED
@@ -1,15 +1,42 @@
1
1
  // src/domains/constants/errorName.constant.ts
2
2
  var CErrorName = {
3
+ assertionError: "AssertionError",
4
+ beforeExit: "beforeExit",
5
+ eacces: "EACCES",
6
+ eaddrinuse: "EADDRINUSE",
7
+ econnrefused: "ECONNREFUSED",
8
+ econnreset: "ECONNRESET",
9
+ eexist: "EEXIST",
10
+ error: "Error",
11
+ eisdir: "EISDIR",
12
+ emfile: "EMFILE",
13
+ enoent: "ENOENT",
14
+ enotdir: "ENOTDIR",
15
+ enotEmpty: "ENOTEMPTY",
16
+ eperm: "EPERM",
17
+ epipe: "EPIPE",
18
+ etimedout: "ETIMEDOUT",
3
19
  evalError: "EvalError",
4
- syntaxError: "SyntaxError",
20
+ errOsslEvpUnsupported: "ERR_OSSL_EVP_UNSUPPORTED",
21
+ errOsslBadDecrypt: "ERR_OSSL_BAD_DECRYPT",
22
+ errOsslWrongFinalBlockLength: "ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH",
23
+ errInvalidArgType: "ERR_INVALID_ARG_TYPE",
24
+ errInvalidCallback: "ERR_INVALID_CALLBACK",
25
+ errHttpHeadersSent: "ERR_HTTP_HEADERS_SENT",
26
+ errStreamDestroyed: "ERR_STREAM_DESTROYED",
27
+ errTlsCertAltnameInvalid: "ERR_TLS_CERT_ALTNAME_INVALID",
28
+ errUnsupportedEsmUrlScheme: "ERR_UNSUPPORTED_ESM_URL_SCHEME",
29
+ exit: "exit",
30
+ generalError: "GeneralError",
31
+ openSSLError: "OpenSSLError",
5
32
  rangeError: "RangeError",
6
33
  referenceError: "ReferenceError",
34
+ systemError: "SystemError",
35
+ syntaxError: "SyntaxError",
7
36
  typeError: "TypeError",
8
37
  uriError: "URIError",
9
- systemError: "SystemError",
10
- assertionError: "AssertionError",
11
- openSSLError: "OpenSSLError",
12
- generalError: "GeneralError"
38
+ uncaughtException: "uncaughtException",
39
+ unhandledRejection: "unhandledRejection"
13
40
  };
14
41
 
15
42
  // src/domains/constants/event.constant.ts
@@ -65,7 +92,7 @@ var StackTraceError = class extends Error {
65
92
  import { HttpStatusCode as status } from "opticore-http-response";
66
93
  var StackTraceAssertionError = class extends StackTraceError {
67
94
  constructor(message) {
68
- super(message, CErrorName.evalError, status.INTERNAL_SERVER_ERROR, true);
95
+ super(message, CErrorName.assertionError, status.INTERNAL_SERVER_ERROR, true);
69
96
  }
70
97
  };
71
98
 
@@ -81,7 +108,7 @@ var StackTraceEvalError = class extends StackTraceError {
81
108
  import { HttpStatusCode as status3 } from "opticore-http-response";
82
109
  var StackTraceGeneralError = class extends StackTraceError {
83
110
  constructor(message) {
84
- super(message, CErrorName.evalError, status3.INTERNAL_SERVER_ERROR, false);
111
+ super(message, CErrorName.generalError, status3.INTERNAL_SERVER_ERROR, false);
85
112
  }
86
113
  };
87
114
 
@@ -89,7 +116,7 @@ var StackTraceGeneralError = class extends StackTraceError {
89
116
  import { HttpStatusCode as status4 } from "opticore-http-response";
90
117
  var StackTraceOpenSSLError = class extends StackTraceError {
91
118
  constructor(message) {
92
- super(message, CErrorName.evalError, status4.INTERNAL_SERVER_ERROR, false);
119
+ super(message, CErrorName.openSSLError, status4.INTERNAL_SERVER_ERROR, false);
93
120
  }
94
121
  };
95
122
 
@@ -97,7 +124,7 @@ var StackTraceOpenSSLError = class extends StackTraceError {
97
124
  import { HttpStatusCode as status5 } from "opticore-http-response";
98
125
  var StackTraceRangeError = class extends StackTraceError {
99
126
  constructor(message) {
100
- super(message, CErrorName.evalError, status5.BAD_REQUEST, true);
127
+ super(message, CErrorName.rangeError, status5.BAD_REQUEST, true);
101
128
  }
102
129
  };
103
130
 
@@ -105,7 +132,7 @@ var StackTraceRangeError = class extends StackTraceError {
105
132
  import { HttpStatusCode as status6 } from "opticore-http-response";
106
133
  var StackTraceReferenceError = class extends StackTraceError {
107
134
  constructor(message) {
108
- super(message, CErrorName.evalError, status6.BAD_REQUEST, true);
135
+ super(message, CErrorName.referenceError, status6.BAD_REQUEST, true);
109
136
  }
110
137
  };
111
138
 
@@ -113,7 +140,7 @@ var StackTraceReferenceError = class extends StackTraceError {
113
140
  import { HttpStatusCode as status7 } from "opticore-http-response";
114
141
  var StackTraceSyntaxError = class extends StackTraceError {
115
142
  constructor(message) {
116
- super(message, CErrorName.evalError, status7.BAD_REQUEST, true);
143
+ super(message, CErrorName.syntaxError, status7.BAD_REQUEST, true);
117
144
  }
118
145
  };
119
146
 
@@ -130,7 +157,7 @@ var StackTraceSystemError = class extends StackTraceError {
130
157
  import { HttpStatusCode as status9 } from "opticore-http-response";
131
158
  var StackTraceTypeError = class extends StackTraceError {
132
159
  constructor(message) {
133
- super(message, CErrorName.evalError, status9.BAD_REQUEST, true);
160
+ super(message, CErrorName.typeError, status9.BAD_REQUEST, true);
134
161
  }
135
162
  };
136
163
 
@@ -138,7 +165,7 @@ var StackTraceTypeError = class extends StackTraceError {
138
165
  import { HttpStatusCode as status10 } from "opticore-http-response";
139
166
  var StackTraceURIError = class extends StackTraceError {
140
167
  constructor(message) {
141
- super(message, CErrorName.evalError, status10.BAD_REQUEST, true);
168
+ super(message, CErrorName.uriError, status10.BAD_REQUEST, true);
142
169
  }
143
170
  };
144
171
 
@@ -166,47 +193,46 @@ var translateCatchExceptionErrorLanguageLoader = (defaultLocalLang) => {
166
193
 
167
194
  // src/core/errors/events/serverListen.event.error.ts
168
195
  var ServerListenEventError = class {
169
- static logger = new LoggerCore();
170
- static stackTrace;
171
- static __init(defaultLocalLang) {
196
+ logger = new LoggerCore();
197
+ stackTrace;
198
+ localeLanguage;
199
+ constructor(defaultLocalLang) {
200
+ this.localeLanguage = defaultLocalLang;
172
201
  translateCatchExceptionErrorLanguageLoader(defaultLocalLang);
173
- return this;
174
202
  }
175
203
  /**
176
- *
177
- * @param defaultLocalLang
178
204
  * @param appPort
205
+ *
179
206
  */
180
- static hostPortUndefined(defaultLocalLang, appPort) {
207
+ hostPortUndefined(appPort) {
181
208
  this.stackTrace = this.traceError(
182
- TranslationLoader2.t("errorHostUrl", defaultLocalLang),
183
- TranslationLoader2.t("listening", defaultLocalLang),
209
+ TranslationLoader2.t("errorHostUrl", this.localeLanguage),
210
+ TranslationLoader2.t("listening", this.localeLanguage),
184
211
  status11.BAD_REQUEST
185
212
  );
186
213
  this.logger.error(
187
214
  this.stackTrace.message,
188
- TranslationLoader2.t("webServer", defaultLocalLang),
189
- TranslationLoader2.t("badPort", defaultLocalLang, { badPort: appPort }),
215
+ TranslationLoader2.t("webServer", this.localeLanguage),
216
+ TranslationLoader2.t("badPort", this.localeLanguage, { badPort: appPort }),
190
217
  this.stackTrace.stack,
191
218
  status11.BAD_REQUEST
192
219
  );
193
220
  process.exit();
194
221
  }
195
222
  /**
196
- *
197
- * @param defaultLocalLang
198
223
  * @param appHost
224
+ *
199
225
  */
200
- static hostUndefined(defaultLocalLang, appHost) {
226
+ hostUndefined(appHost) {
201
227
  this.stackTrace = this.traceError(
202
- TranslationLoader2.t("badHost", defaultLocalLang, { badHost: appHost }),
203
- TranslationLoader2.t("listening", defaultLocalLang),
228
+ TranslationLoader2.t("badHost", this.localeLanguage, { badHost: appHost }),
229
+ TranslationLoader2.t("listening", this.localeLanguage),
204
230
  status11.BAD_REQUEST
205
231
  );
206
232
  this.logger.error(
207
233
  this.stackTrace.message,
208
- TranslationLoader2.t("webServer", defaultLocalLang),
209
- TranslationLoader2.t("badHost", defaultLocalLang),
234
+ TranslationLoader2.t("webServer", this.localeLanguage),
235
+ TranslationLoader2.t("badHost", this.localeLanguage),
210
236
  this.stackTrace.stack,
211
237
  status11.BAD_REQUEST
212
238
  );
@@ -215,31 +241,30 @@ var ServerListenEventError = class {
215
241
  /**
216
242
  *
217
243
  */
218
- static portUndefined(defaultLocalLang) {
244
+ portUndefined() {
219
245
  this.stackTrace = this.traceError(
220
- TranslationLoader2.t("badPort", defaultLocalLang),
221
- TranslationLoader2.t("listening", defaultLocalLang),
246
+ TranslationLoader2.t("badPort", this.localeLanguage),
247
+ TranslationLoader2.t("listening", this.localeLanguage),
222
248
  status11.BAD_REQUEST
223
249
  );
224
250
  this.logger.error(
225
251
  this.stackTrace.message,
226
- TranslationLoader2.t("webServer", defaultLocalLang),
227
- TranslationLoader2.t("badHost", defaultLocalLang),
252
+ TranslationLoader2.t("webServer", this.localeLanguage),
253
+ TranslationLoader2.t("badHost", this.localeLanguage),
228
254
  this.stackTrace.stack,
229
255
  status11.BAD_REQUEST
230
256
  );
231
257
  process.exit();
232
258
  }
233
259
  /**
234
- *
235
260
  * @param err
236
- * @param defaultLocalLang
261
+ *
237
262
  */
238
- static onEventError(err, defaultLocalLang) {
263
+ onEventError(err) {
239
264
  this.logger.error(
240
- TranslationLoader2.t(err.message, defaultLocalLang),
241
- TranslationLoader2.t("serverStart", defaultLocalLang),
242
- TranslationLoader2.t("serverStartError", defaultLocalLang, { err }),
265
+ TranslationLoader2.t(err.message, this.localeLanguage),
266
+ TranslationLoader2.t("serverStart", this.localeLanguage),
267
+ TranslationLoader2.t("serverStartError", this.localeLanguage, { err }),
243
268
  err.stack,
244
269
  status11.SERVICE_UNAVAILABLE
245
270
  );
@@ -248,7 +273,7 @@ var ServerListenEventError = class {
248
273
  *
249
274
  * @param error
250
275
  */
251
- static listenerError(error) {
276
+ listenerError(error) {
252
277
  this.stackTrace = this.traceError(
253
278
  error.message,
254
279
  error.name,
@@ -263,20 +288,19 @@ var ServerListenEventError = class {
263
288
  );
264
289
  }
265
290
  /**
266
- *
267
291
  * @param code
268
- * @param defaultLocalLang
292
+ *
269
293
  */
270
- static processBeforeExit(code, defaultLocalLang) {
294
+ processBeforeExit(code) {
271
295
  this.stackTrace = this.traceError(
272
- TranslationLoader2.t("processExitCode", defaultLocalLang, { processExitCode: code }),
273
- TranslationLoader2.t("beforeExit", defaultLocalLang),
296
+ TranslationLoader2.t("processExitCode", this.localeLanguage, { processExitCode: code }),
297
+ TranslationLoader2.t("beforeExit", this.localeLanguage),
274
298
  status11.SERVICE_UNAVAILABLE
275
299
  );
276
300
  this.logger.error(
277
301
  this.stackTrace.message,
278
- TranslationLoader2.t("beforeExit", defaultLocalLang),
279
- TranslationLoader2.t("processBeforeExit", defaultLocalLang),
302
+ TranslationLoader2.t("beforeExit", this.localeLanguage),
303
+ TranslationLoader2.t("processBeforeExit", this.localeLanguage),
280
304
  this.stackTrace.stack,
281
305
  status11.SERVICE_UNAVAILABLE
282
306
  );
@@ -285,16 +309,16 @@ var ServerListenEventError = class {
285
309
  /**
286
310
  *
287
311
  */
288
- static processDisconnected(defaultLocalLang) {
312
+ processDisconnected() {
289
313
  this.stackTrace = this.traceError(
290
- TranslationLoader2.t("childProcessDiscon", defaultLocalLang),
291
- TranslationLoader2.t("processDiscon", defaultLocalLang),
314
+ TranslationLoader2.t("childProcessDiscon", this.localeLanguage),
315
+ TranslationLoader2.t("processDiscon", this.localeLanguage),
292
316
  status11.SERVICE_UNAVAILABLE
293
317
  );
294
318
  this.logger.error(
295
319
  this.stackTrace.message,
296
- TranslationLoader2.t("disconnected", defaultLocalLang),
297
- TranslationLoader2.t("processDiscon", defaultLocalLang),
320
+ TranslationLoader2.t("disconnected", this.localeLanguage),
321
+ TranslationLoader2.t("processDiscon", this.localeLanguage),
298
322
  this.stackTrace.stack,
299
323
  status11.SERVICE_UNAVAILABLE
300
324
  );
@@ -303,31 +327,30 @@ var ServerListenEventError = class {
303
327
  /**
304
328
  *
305
329
  * @param code
306
- * @param defaultLocalLang
307
330
  */
308
- static exited(code, defaultLocalLang) {
331
+ exited(code) {
309
332
  switch (code) {
310
333
  case 0:
311
334
  this.logger.success(
312
- TranslationLoader2.t("completed", defaultLocalLang, { code }),
313
- TranslationLoader2.t("finishingProcessWell", defaultLocalLang, { code })
335
+ TranslationLoader2.t("completed", this.localeLanguage, { code }),
336
+ TranslationLoader2.t("finishingProcessWell", this.localeLanguage, { code })
314
337
  );
315
338
  console.log("");
316
339
  const paddingLength = 35;
317
340
  const msg0 = " ".padEnd(paddingLength, " ");
318
341
  console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
319
- console.log(`${colors.bgGreen(` ${TranslationLoader2.t("serverStopped", defaultLocalLang)} `)}`);
342
+ console.log(`${colors.bgGreen(` ${TranslationLoader2.t("serverStopped", this.localeLanguage)} `)}`);
320
343
  console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
321
344
  break;
322
345
  case 1:
323
346
  this.stackTrace = this.traceError(
324
- TranslationLoader2.t("somethingWentWrong", defaultLocalLang),
325
- TranslationLoader2.t("genErrors", defaultLocalLang),
347
+ TranslationLoader2.t("somethingWentWrong", this.localeLanguage),
348
+ TranslationLoader2.t("genErrors", this.localeLanguage),
326
349
  status11.SERVICE_UNAVAILABLE
327
350
  );
328
351
  this.logger.error(
329
352
  this.stackTrace.message,
330
- TranslationLoader2.t("exited", defaultLocalLang),
353
+ TranslationLoader2.t("exited", this.localeLanguage),
331
354
  "General Errors",
332
355
  this.stackTrace.stack,
333
356
  status11.SERVICE_UNAVAILABLE
@@ -335,27 +358,27 @@ var ServerListenEventError = class {
335
358
  break;
336
359
  case 2:
337
360
  this.stackTrace = this.traceError(
338
- TranslationLoader2.t("incorrectCmd", defaultLocalLang),
339
- TranslationLoader2.t("misuseShell", defaultLocalLang),
361
+ TranslationLoader2.t("incorrectCmd", this.localeLanguage),
362
+ TranslationLoader2.t("misuseShell", this.localeLanguage),
340
363
  status11.SERVICE_UNAVAILABLE
341
364
  );
342
365
  this.logger.error(
343
366
  this.stackTrace.message,
344
- TranslationLoader2.t("exited", defaultLocalLang),
345
- TranslationLoader2.t("incorrectCmd", defaultLocalLang),
367
+ TranslationLoader2.t("exited", this.localeLanguage),
368
+ TranslationLoader2.t("incorrectCmd", this.localeLanguage),
346
369
  this.stackTrace.stack,
347
370
  status11.SERVICE_UNAVAILABLE
348
371
  );
349
372
  break;
350
373
  case 126:
351
374
  this.stackTrace = this.traceError(
352
- TranslationLoader2.t("incorrectCmd", defaultLocalLang),
353
- TranslationLoader2.t("cmdNotExecutable", defaultLocalLang),
375
+ TranslationLoader2.t("incorrectCmd", this.localeLanguage),
376
+ TranslationLoader2.t("cmdNotExecutable", this.localeLanguage),
354
377
  status11.SERVICE_UNAVAILABLE
355
378
  );
356
379
  this.logger.error(
357
380
  this.stackTrace.message,
358
- TranslationLoader2.t("exited", defaultLocalLang),
381
+ TranslationLoader2.t("exited", this.localeLanguage),
359
382
  this.stackTrace.name,
360
383
  this.stackTrace.stack,
361
384
  status11.SERVICE_UNAVAILABLE
@@ -363,13 +386,13 @@ var ServerListenEventError = class {
363
386
  break;
364
387
  case 127:
365
388
  this.stackTrace = this.traceError(
366
- TranslationLoader2.t("cmdNotFound", defaultLocalLang),
367
- TranslationLoader2.t("cmdNotFoundInSystemPath", defaultLocalLang),
389
+ TranslationLoader2.t("cmdNotFound", this.localeLanguage),
390
+ TranslationLoader2.t("cmdNotFoundInSystemPath", this.localeLanguage),
368
391
  status11.SERVICE_UNAVAILABLE
369
392
  );
370
393
  this.logger.error(
371
394
  this.stackTrace.message,
372
- TranslationLoader2.t("exited", defaultLocalLang),
395
+ TranslationLoader2.t("exited", this.localeLanguage),
373
396
  this.stackTrace.name,
374
397
  this.stackTrace.stack,
375
398
  status11.SERVICE_UNAVAILABLE
@@ -377,13 +400,13 @@ var ServerListenEventError = class {
377
400
  break;
378
401
  case 128:
379
402
  this.stackTrace = this.traceError(
380
- TranslationLoader2.t("cmdNotFoundInSystemPath", defaultLocalLang),
381
- TranslationLoader2.t("argInvalid", defaultLocalLang),
403
+ TranslationLoader2.t("cmdNotFoundInSystemPath", this.localeLanguage),
404
+ TranslationLoader2.t("argInvalid", this.localeLanguage),
382
405
  status11.SERVICE_UNAVAILABLE
383
406
  );
384
407
  this.logger.error(
385
408
  this.stackTrace.message,
386
- TranslationLoader2.t("exited", defaultLocalLang),
409
+ TranslationLoader2.t("exited", this.localeLanguage),
387
410
  this.stackTrace.name,
388
411
  this.stackTrace.stack,
389
412
  status11.SERVICE_UNAVAILABLE
@@ -391,13 +414,13 @@ var ServerListenEventError = class {
391
414
  break;
392
415
  case 130:
393
416
  this.stackTrace = this.traceError(
394
- TranslationLoader2.t("scriptEndedManuallyByCtrlC", defaultLocalLang),
395
- TranslationLoader2.t("scriptEnded", defaultLocalLang),
417
+ TranslationLoader2.t("scriptEndedManuallyByCtrlC", this.localeLanguage),
418
+ TranslationLoader2.t("scriptEnded", this.localeLanguage),
396
419
  status11.SERVICE_UNAVAILABLE
397
420
  );
398
421
  this.logger.error(
399
422
  this.stackTrace.message,
400
- TranslationLoader2.t("exited", defaultLocalLang),
423
+ TranslationLoader2.t("exited", this.localeLanguage),
401
424
  this.stackTrace.name,
402
425
  this.stackTrace.stack,
403
426
  status11.SERVICE_UNAVAILABLE
@@ -405,13 +428,13 @@ var ServerListenEventError = class {
405
428
  break;
406
429
  case 137:
407
430
  this.stackTrace = this.traceError(
408
- TranslationLoader2.t("processEndedBySIGKILL", defaultLocalLang),
431
+ TranslationLoader2.t("processEndedBySIGKILL", this.localeLanguage),
409
432
  "SIGKILL",
410
433
  status11.SERVICE_UNAVAILABLE
411
434
  );
412
435
  this.logger.error(
413
436
  this.stackTrace.message,
414
- TranslationLoader2.t("exited", defaultLocalLang),
437
+ TranslationLoader2.t("exited", this.localeLanguage),
415
438
  this.stackTrace.name,
416
439
  this.stackTrace.stack,
417
440
  status11.SERVICE_UNAVAILABLE
@@ -419,13 +442,13 @@ var ServerListenEventError = class {
419
442
  break;
420
443
  case 139:
421
444
  this.stackTrace = this.traceError(
422
- TranslationLoader2.t("accessProcessIllegally", defaultLocalLang),
423
- TranslationLoader2.t("defaultSegment", defaultLocalLang),
445
+ TranslationLoader2.t("accessProcessIllegally", this.localeLanguage),
446
+ TranslationLoader2.t("defaultSegment", this.localeLanguage),
424
447
  status11.SERVICE_UNAVAILABLE
425
448
  );
426
449
  this.logger.error(
427
450
  this.stackTrace.message,
428
- TranslationLoader2.t("exited", defaultLocalLang),
451
+ TranslationLoader2.t("exited", this.localeLanguage),
429
452
  this.stackTrace.name,
430
453
  this.stackTrace.stack,
431
454
  status11.SERVICE_UNAVAILABLE
@@ -433,13 +456,13 @@ var ServerListenEventError = class {
433
456
  break;
434
457
  case 143:
435
458
  this.stackTrace = this.traceError(
436
- TranslationLoader2.t("processReceivedSigtermSignal", defaultLocalLang),
437
- TranslationLoader2.t("processReceived", defaultLocalLang),
459
+ TranslationLoader2.t("processReceivedSigtermSignal", this.localeLanguage),
460
+ TranslationLoader2.t("processReceived", this.localeLanguage),
438
461
  status11.SERVICE_UNAVAILABLE
439
462
  );
440
463
  this.logger.error(
441
464
  this.stackTrace.message,
442
- TranslationLoader2.t("exited", defaultLocalLang),
465
+ TranslationLoader2.t("exited", this.localeLanguage),
443
466
  this.stackTrace.name,
444
467
  this.stackTrace.stack,
445
468
  status11.SERVICE_UNAVAILABLE
@@ -447,13 +470,13 @@ var ServerListenEventError = class {
447
470
  break;
448
471
  case 255:
449
472
  this.stackTrace = this.traceError(
450
- TranslationLoader2.t("exitCode", defaultLocalLang),
451
- TranslationLoader2.t("outRange", defaultLocalLang),
473
+ TranslationLoader2.t("exitCode", this.localeLanguage),
474
+ TranslationLoader2.t("outRange", this.localeLanguage),
452
475
  status11.SERVICE_UNAVAILABLE
453
476
  );
454
477
  this.logger.error(
455
478
  this.stackTrace.message,
456
- TranslationLoader2.t("exited", defaultLocalLang),
479
+ TranslationLoader2.t("exited", this.localeLanguage),
457
480
  this.stackTrace.name,
458
481
  this.stackTrace.stack,
459
482
  status11.SERVICE_UNAVAILABLE
@@ -461,13 +484,13 @@ var ServerListenEventError = class {
461
484
  break;
462
485
  default:
463
486
  this.stackTrace = this.traceError(
464
- TranslationLoader2.t("errorOccurring", defaultLocalLang),
465
- TranslationLoader2.t("errors", defaultLocalLang),
487
+ TranslationLoader2.t("errorOccurring", this.localeLanguage),
488
+ TranslationLoader2.t("errors", this.localeLanguage),
466
489
  status11.SERVICE_UNAVAILABLE
467
490
  );
468
491
  this.logger.error(
469
492
  this.stackTrace.message,
470
- TranslationLoader2.t("exited", defaultLocalLang),
493
+ TranslationLoader2.t("exited", this.localeLanguage),
471
494
  this.stackTrace.name,
472
495
  this.stackTrace.stack,
473
496
  status11.SERVICE_UNAVAILABLE
@@ -478,13 +501,12 @@ var ServerListenEventError = class {
478
501
  /**
479
502
  *
480
503
  * @param promise
481
- * @param defaultLocalLang
482
504
  */
483
- static promiseRejectionHandled(promise, defaultLocalLang) {
505
+ promiseRejectionHandled(promise) {
484
506
  try {
485
507
  this.stackTrace = this.traceError(
486
- TranslationLoader2.t("promise", defaultLocalLang, { promise }),
487
- TranslationLoader2.t("rejectionPromise", defaultLocalLang, { promise }),
508
+ TranslationLoader2.t("promise", this.localeLanguage, { promise }),
509
+ TranslationLoader2.t("rejectionPromise", this.localeLanguage, { promise }),
488
510
  status11.SERVICE_UNAVAILABLE
489
511
  );
490
512
  this.logger.error(
@@ -500,15 +522,14 @@ var ServerListenEventError = class {
500
522
  /**
501
523
  *
502
524
  * @param error
503
- * @param defaultLocalLang
504
525
  */
505
- static uncaughtException(error, defaultLocalLang) {
526
+ uncaughtException(error) {
506
527
  if (error.message === "'app.router' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.") {
507
528
  console.log("");
508
529
  } else {
509
530
  this.stackTrace = this.traceError(
510
- TranslationLoader2.t(error.message, defaultLocalLang),
511
- TranslationLoader2.t("uncaughtExceptionHandled", defaultLocalLang),
531
+ TranslationLoader2.t(error.message, this.localeLanguage, { error: error.stack }),
532
+ TranslationLoader2.t("uncaughtExceptionHandled", this.localeLanguage),
512
533
  status11.SERVICE_UNAVAILABLE
513
534
  );
514
535
  this.logger.error(
@@ -524,7 +545,7 @@ var ServerListenEventError = class {
524
545
  *
525
546
  * @param error
526
547
  */
527
- static uncaughtExceptionMonitor(error) {
548
+ uncaughtExceptionMonitor(error) {
528
549
  if (error.message === "'app.router' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.") {
529
550
  console.log("");
530
551
  }
@@ -533,12 +554,11 @@ var ServerListenEventError = class {
533
554
  *
534
555
  * @param reason
535
556
  * @param promise
536
- * @param defaultLocalLang
537
557
  */
538
- static unhandledRejection(reason, promise, defaultLocalLang) {
558
+ unhandledRejection(reason, promise) {
539
559
  this.stackTrace = this.traceError(
540
- TranslationLoader2.t("unhandledRejectionAtPromise", defaultLocalLang, { promise, reason }),
541
- TranslationLoader2.t("unhandledRejection", defaultLocalLang, { promise, reason }),
560
+ TranslationLoader2.t("unhandledRejectionAtPromise", this.localeLanguage, { promise, reason }),
561
+ TranslationLoader2.t("unhandledRejection", this.localeLanguage, { promise, reason }),
542
562
  status11.SERVICE_UNAVAILABLE
543
563
  );
544
564
  this.logger.error(
@@ -552,17 +572,16 @@ var ServerListenEventError = class {
552
572
  /**
553
573
  *
554
574
  * @param warning
555
- * @param defaultLocalLang
556
575
  */
557
- static warning(warning, defaultLocalLang) {
576
+ warning(warning) {
558
577
  this.stackTrace = this.traceError(
559
- TranslationLoader2.t(warning.message, defaultLocalLang),
578
+ TranslationLoader2.t(warning.message, this.localeLanguage),
560
579
  "warning",
561
580
  status11.SERVICE_UNAVAILABLE
562
581
  );
563
582
  this.logger.error(
564
583
  this.stackTrace.message,
565
- TranslationLoader2.t("warning", defaultLocalLang, { warning }),
584
+ TranslationLoader2.t("warning", this.localeLanguage, { warning }),
566
585
  this.stackTrace.name,
567
586
  this.stackTrace.stack,
568
587
  status11.SERVICE_UNAVAILABLE
@@ -571,12 +590,11 @@ var ServerListenEventError = class {
571
590
  /**
572
591
  *
573
592
  * @param message
574
- * @param defaultLocalLang
575
593
  */
576
- static message(message, defaultLocalLang) {
594
+ message(message) {
577
595
  this.stackTrace = this.traceError(
578
- TranslationLoader2.t("processGotMsg", defaultLocalLang, { message }),
579
- TranslationLoader2.t("msgException", defaultLocalLang, { message }),
596
+ TranslationLoader2.t("processGotMsg", this.localeLanguage, { message }),
597
+ TranslationLoader2.t("msgException", this.localeLanguage, { message }),
580
598
  status11.SERVICE_UNAVAILABLE
581
599
  );
582
600
  this.logger.error(
@@ -592,12 +610,11 @@ var ServerListenEventError = class {
592
610
  * @param type
593
611
  * @param promise
594
612
  * @param reason
595
- * @param defaultLocalLang
596
613
  */
597
- static multipleResolves(type, promise, reason, defaultLocalLang) {
614
+ multipleResolves(type, promise, reason) {
598
615
  this.stackTrace = this.traceError(
599
- TranslationLoader2.t("promiseReason", defaultLocalLang, { promise, reason }),
600
- TranslationLoader2.t("multipleResolvesDetected", defaultLocalLang, { type, promise, reason }),
616
+ TranslationLoader2.t("promiseReason", this.localeLanguage, { promise, reason }),
617
+ TranslationLoader2.t("multipleResolvesDetected", this.localeLanguage, { type, promise, reason }),
601
618
  status11.SERVICE_UNAVAILABLE
602
619
  );
603
620
  this.logger.error(
@@ -611,18 +628,20 @@ var ServerListenEventError = class {
611
628
  /**
612
629
  *
613
630
  */
614
- static processInterrupted(defaultLocalLang) {
615
- this.logger.success(TranslationLoader2.t("okSuccess", defaultLocalLang), TranslationLoader2.t("serverWebStopped", defaultLocalLang));
631
+ processInterrupted() {
632
+ this.logger.success(
633
+ TranslationLoader2.t("okSuccess", this.localeLanguage),
634
+ TranslationLoader2.t("serverWebStopped", this.localeLanguage)
635
+ );
616
636
  process.exit(0);
617
637
  }
618
638
  /**
619
639
  *
620
640
  * @param signal
621
- * @param defaultLocalLang
622
641
  */
623
- static sigtermSignalReceived(signal, defaultLocalLang) {
642
+ sigtermSignalReceived(signal) {
624
643
  this.stackTrace = this.traceError(
625
- TranslationLoader2.t("processPIDReceivedSignal", defaultLocalLang, { signal: signal.toString() }),
644
+ TranslationLoader2.t("processPIDReceivedSignal", this.localeLanguage, { signal: signal.toString() }),
626
645
  "SIGTERM",
627
646
  status11.NOT_ACCEPTABLE
628
647
  );
@@ -638,16 +657,16 @@ var ServerListenEventError = class {
638
657
  /**
639
658
  *
640
659
  */
641
- static serverClosing(defaultLocalLang) {
642
- console.log(`${colors.bgCyanBright(` ${colors.bold(`${colors.white(` INFO `)}`)}`)} ${TranslationLoader2.t("allProcessStopped", defaultLocalLang)}`);
643
- console.log(` ${TranslationLoader2.t("serverClosed", defaultLocalLang)}`);
660
+ serverClosing() {
661
+ console.log(`${colors.bgCyanBright(` ${colors.bold(`${colors.white(` INFO `)}`)}`)} ${TranslationLoader2.t("allProcessStopped", this.localeLanguage)}`);
662
+ console.log(` ${TranslationLoader2.t("serverClosed", this.localeLanguage)}`);
644
663
  process.exit();
645
664
  }
646
665
  /**
647
666
  *
648
667
  */
649
- static dropNewConnection(defaultLocalLang) {
650
- console.log(`${colors.cyan(`\u24D8`)} ${colors.bgCyan(` ${colors.bold(`${colors.white(` ${TranslationLoader2.t("serverMaxCon", defaultLocalLang)} `)}`)} `)} ${dateTimeFormatted} | ${colors.bgCyan(`${colors.white(` Info `)}`)} ${TranslationLoader2.t("serverDroppedCon", defaultLocalLang)}`);
668
+ dropNewConnection() {
669
+ console.log(`${colors.cyan(`\u24D8`)} ${colors.bgCyan(` ${colors.bold(`${colors.white(` ${TranslationLoader2.t("serverMaxCon", this.localeLanguage)} `)}`)} `)} ${dateTimeFormatted} | ${colors.bgCyan(`${colors.white(` Info `)}`)} ${TranslationLoader2.t("serverDroppedCon", this.localeLanguage)}`);
651
670
  }
652
671
  /**
653
672
  *
@@ -656,30 +675,29 @@ var ServerListenEventError = class {
656
675
  * @param req
657
676
  * @param res
658
677
  * @param next
659
- * @param defaultLocalLang
660
678
  */
661
- static expressErrorHandlingMiddleware(errorEmitter, err, req, res, next, defaultLocalLang) {
679
+ expressErrorHandlingMiddleware(errorEmitter, err, req, res, next) {
662
680
  if (err) {
663
681
  errorEmitter.emit(CEventNameError.error, err);
664
682
  if (typeof res.status === "function") {
665
- res.status(500).send(TranslationLoader2.t("internalServerError", defaultLocalLang, { err }));
683
+ res.status(500).send(TranslationLoader2.t("internalServerError", this.localeLanguage, { err }));
666
684
  } else {
667
685
  this.logger.error(
668
- TranslationLoader2.t("resStatusNotFunc", defaultLocalLang, { err }),
686
+ TranslationLoader2.t("resStatusNotFunc", this.localeLanguage, { err }),
669
687
  "response status",
670
- TranslationLoader2.t("respndNotFunc", defaultLocalLang, { err }),
688
+ TranslationLoader2.t("respndNotFunc", this.localeLanguage, { err }),
671
689
  err.stack,
672
690
  status11.NOT_ACCEPTABLE
673
691
  );
674
692
  }
675
693
  this.stackTrace = this.traceError(
676
694
  err.message,
677
- TranslationLoader2.t("expressError", defaultLocalLang, { err }),
695
+ TranslationLoader2.t("expressError", this.localeLanguage, { err }),
678
696
  status11.NOT_ACCEPTABLE
679
697
  );
680
698
  this.logger.error(
681
699
  this.stackTrace.message,
682
- TranslationLoader2.t("expressErrorHandlingMiddleware", defaultLocalLang, { err }),
700
+ TranslationLoader2.t("expressErrorHandlingMiddleware", this.localeLanguage, { err }),
683
701
  this.stackTrace.name,
684
702
  this.stackTrace.stack,
685
703
  status11.SERVICE_UNAVAILABLE
@@ -688,8 +706,216 @@ var ServerListenEventError = class {
688
706
  next();
689
707
  }
690
708
  }
691
- static traceError(props, name, status12) {
692
- return new StackTraceError(props, name, status12, true);
709
+ traceError(props, name, status38) {
710
+ return new StackTraceError(props, name, status38, true);
711
+ }
712
+ };
713
+
714
+ // src/core/errors/stackTraceEACCES.ts
715
+ import { HttpStatusCode as status12 } from "opticore-http-response";
716
+ var StackTraceEACCES = class extends StackTraceError {
717
+ constructor(message) {
718
+ super(message, CErrorName.eacces, status12.INTERNAL_SERVER_ERROR, true);
719
+ }
720
+ };
721
+
722
+ // src/core/errors/stackTraceEADDRINUSE.ts
723
+ import { HttpStatusCode as status13 } from "opticore-http-response";
724
+ var StackTraceEADDRINUSE = class extends StackTraceError {
725
+ constructor(message) {
726
+ super(message, CErrorName.eaddrinuse, status13.INTERNAL_SERVER_ERROR, true);
727
+ }
728
+ };
729
+
730
+ // src/core/errors/stackTraceECONNREFUSED.ts
731
+ import { HttpStatusCode as status14 } from "opticore-http-response";
732
+ var StackTraceECONNREFUSED = class extends StackTraceError {
733
+ constructor(message) {
734
+ super(message, CErrorName.econnrefused, status14.INTERNAL_SERVER_ERROR, true);
735
+ }
736
+ };
737
+
738
+ // src/core/errors/stackTraceECONNRESET.ts
739
+ import { HttpStatusCode as status15 } from "opticore-http-response";
740
+ var StackTraceECONNRESET = class extends StackTraceError {
741
+ constructor(message) {
742
+ super(message, CErrorName.econnreset, status15.INTERNAL_SERVER_ERROR, true);
743
+ }
744
+ };
745
+
746
+ // src/core/errors/stackTraceEEXIST.ts
747
+ import { HttpStatusCode as status16 } from "opticore-http-response";
748
+ var StackTraceEEXIST = class extends StackTraceError {
749
+ constructor(message) {
750
+ super(message, CErrorName.eexist, status16.INTERNAL_SERVER_ERROR, true);
751
+ }
752
+ };
753
+
754
+ // src/core/errors/stackTraceEISDIR.ts
755
+ import { HttpStatusCode as status17 } from "opticore-http-response";
756
+ var StackTraceEISDIR = class extends StackTraceError {
757
+ constructor(message) {
758
+ super(message, CErrorName.eisdir, status17.INTERNAL_SERVER_ERROR, true);
759
+ }
760
+ };
761
+
762
+ // src/core/errors/stackTraceEMFILE.ts
763
+ import { HttpStatusCode as status18 } from "opticore-http-response";
764
+ var StackTraceEMFILE = class extends StackTraceError {
765
+ constructor(message) {
766
+ super(message, CErrorName.emfile, status18.INTERNAL_SERVER_ERROR, true);
767
+ }
768
+ };
769
+
770
+ // src/core/errors/stackTraceENOENT.ts
771
+ import { HttpStatusCode as status19 } from "opticore-http-response";
772
+ var StackTraceENOENT = class extends StackTraceError {
773
+ constructor(message) {
774
+ super(message, CErrorName.enoent, status19.INTERNAL_SERVER_ERROR, true);
775
+ }
776
+ };
777
+
778
+ // src/core/errors/stackTraceENOTDIR.ts
779
+ import { HttpStatusCode as status20 } from "opticore-http-response";
780
+ var StackTraceENOTDIR = class extends StackTraceError {
781
+ constructor(message) {
782
+ super(message, CErrorName.enotdir, status20.INTERNAL_SERVER_ERROR, true);
783
+ }
784
+ };
785
+
786
+ // src/core/errors/stackTraceENOTEMPTY.ts
787
+ import { HttpStatusCode as status21 } from "opticore-http-response";
788
+ var StackTraceENOTEMPTY = class extends StackTraceError {
789
+ constructor(message) {
790
+ super(message, CErrorName.enotEmpty, status21.INTERNAL_SERVER_ERROR, true);
791
+ }
792
+ };
793
+
794
+ // src/core/errors/stackTraceEPERM.ts
795
+ import { HttpStatusCode as status22 } from "opticore-http-response";
796
+ var StackTraceEPERM = class extends StackTraceError {
797
+ constructor(message) {
798
+ super(message, CErrorName.eperm, status22.INTERNAL_SERVER_ERROR, true);
799
+ }
800
+ };
801
+
802
+ // src/core/errors/stackTraceEPIPE.ts
803
+ import { HttpStatusCode as status23 } from "opticore-http-response";
804
+ var StackTraceEPIPE = class extends StackTraceError {
805
+ constructor(message) {
806
+ super(message, CErrorName.epipe, status23.INTERNAL_SERVER_ERROR, true);
807
+ }
808
+ };
809
+
810
+ // src/core/errors/stackTraceETIMEDOUT.ts
811
+ import { HttpStatusCode as status24 } from "opticore-http-response";
812
+ var StackTraceETIMEDOUT = class extends StackTraceError {
813
+ constructor(message) {
814
+ super(message, CErrorName.etimedout, status24.INTERNAL_SERVER_ERROR, true);
815
+ }
816
+ };
817
+
818
+ // src/core/errors/stackTraceERR_OSSL_EVP_UNSUPPORTED.ts
819
+ import { HttpStatusCode as status25 } from "opticore-http-response";
820
+ var StackTraceERR_OSSL_EVP_UNSUPPORTED = class extends StackTraceError {
821
+ constructor(message) {
822
+ super(message, CErrorName.errOsslEvpUnsupported, status25.NOT_ACCEPTABLE, true);
823
+ }
824
+ };
825
+
826
+ // src/core/errors/stackTraceERR_OSSL_BAD_DECRYPT.ts
827
+ import { HttpStatusCode as status26 } from "opticore-http-response";
828
+ var StackTraceERR_OSSL_BAD_DECRYPT = class extends StackTraceError {
829
+ constructor(message) {
830
+ super(message, CErrorName.errOsslBadDecrypt, status26.BAD_REQUEST, true);
831
+ }
832
+ };
833
+
834
+ // src/core/errors/stackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH.ts
835
+ import { HttpStatusCode as status27 } from "opticore-http-response";
836
+ var StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH = class extends StackTraceError {
837
+ constructor(message) {
838
+ super(message, CErrorName.errOsslWrongFinalBlockLength, status27.NOT_ACCEPTABLE, true);
839
+ }
840
+ };
841
+
842
+ // src/core/errors/stackTraceERR_INVALID_ARG_TYPE.ts
843
+ import { HttpStatusCode as status28 } from "opticore-http-response";
844
+ var StackTraceERR_INVALID_ARG_TYPE = class extends StackTraceError {
845
+ constructor(message) {
846
+ super(message, CErrorName.errInvalidArgType, status28.INTERNAL_SERVER_ERROR, true);
847
+ }
848
+ };
849
+
850
+ // src/core/errors/stackTraceERR_INVALID_CALLBACK.ts
851
+ import { HttpStatusCode as status29 } from "opticore-http-response";
852
+ var StackTraceERR_INVALID_CALLBACK = class extends StackTraceError {
853
+ constructor(message) {
854
+ super(message, CErrorName.errInvalidCallback, status29.INTERNAL_SERVER_ERROR, true);
855
+ }
856
+ };
857
+
858
+ // src/core/errors/stackTraceERR_HTTP_HEADERS_SENT.ts
859
+ import { HttpStatusCode as status30 } from "opticore-http-response";
860
+ var StackTraceERR_HTTP_HEADERS_SENT = class extends StackTraceError {
861
+ constructor(message) {
862
+ super(message, CErrorName.errHttpHeadersSent, status30.INTERNAL_SERVER_ERROR, true);
863
+ }
864
+ };
865
+
866
+ // src/core/errors/stackTraceERR_STREAM_DESTROYED.ts
867
+ import { HttpStatusCode as status31 } from "opticore-http-response";
868
+ var StackTraceERR_STREAM_DESTROYED = class extends StackTraceError {
869
+ constructor(message) {
870
+ super(message, CErrorName.errStreamDestroyed, status31.INTERNAL_SERVER_ERROR, true);
871
+ }
872
+ };
873
+
874
+ // src/core/errors/stackTraceERR_TLS_CERT_ALTNAME_INVALID.ts
875
+ import { HttpStatusCode as status32 } from "opticore-http-response";
876
+ var StackTraceERR_TLS_CERT_ALTNAME_INVALID = class extends StackTraceError {
877
+ constructor(message) {
878
+ super(message, CErrorName.errTlsCertAltnameInvalid, status32.INTERNAL_SERVER_ERROR, true);
879
+ }
880
+ };
881
+
882
+ // src/core/errors/stackTraceERR_UNSUPPORTED_ESM_URL_SCHEME.ts
883
+ import { HttpStatusCode as status33 } from "opticore-http-response";
884
+ var StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME = class extends StackTraceError {
885
+ constructor(message) {
886
+ super(message, CErrorName.errUnsupportedEsmUrlScheme, status33.INTERNAL_SERVER_ERROR, true);
887
+ }
888
+ };
889
+
890
+ // src/core/errors/stackTraceUncaughtException.ts
891
+ import { HttpStatusCode as status34 } from "opticore-http-response";
892
+ var StackTraceUncaughtException = class extends StackTraceError {
893
+ constructor(message) {
894
+ super(message, CEvent.uncaughtException, status34.INTERNAL_SERVER_ERROR, true);
895
+ }
896
+ };
897
+
898
+ // src/core/errors/stackTraceUnhandledRejection.ts
899
+ import { HttpStatusCode as status35 } from "opticore-http-response";
900
+ var StackTraceUnhandledRejection = class extends StackTraceError {
901
+ constructor(message) {
902
+ super(message, CEvent.unhandledRejection, status35.INTERNAL_SERVER_ERROR, true);
903
+ }
904
+ };
905
+
906
+ // src/core/errors/stackTraceBeforeExit.ts
907
+ import { HttpStatusCode as status36 } from "opticore-http-response";
908
+ var StackTraceBeforeExit = class extends StackTraceError {
909
+ constructor(message) {
910
+ super(message, CEvent.beforeExit, status36.INTERNAL_SERVER_ERROR, true);
911
+ }
912
+ };
913
+
914
+ // src/core/errors/stackTraceExit.ts
915
+ import { HttpStatusCode as status37 } from "opticore-http-response";
916
+ var StackTraceExit = class extends StackTraceError {
917
+ constructor(message) {
918
+ super(message, CEvent.exit, status37.INTERNAL_SERVER_ERROR, true);
693
919
  }
694
920
  };
695
921
  export {
@@ -698,8 +924,32 @@ export {
698
924
  CEventNameError,
699
925
  ServerListenEventError,
700
926
  StackTraceAssertionError,
927
+ StackTraceBeforeExit,
928
+ StackTraceEACCES,
929
+ StackTraceEADDRINUSE,
930
+ StackTraceECONNREFUSED,
931
+ StackTraceECONNRESET,
932
+ StackTraceEEXIST,
933
+ StackTraceEISDIR,
934
+ StackTraceEMFILE,
935
+ StackTraceENOENT,
936
+ StackTraceENOTDIR,
937
+ StackTraceENOTEMPTY,
938
+ StackTraceEPERM,
939
+ StackTraceEPIPE,
940
+ StackTraceERR_HTTP_HEADERS_SENT,
941
+ StackTraceERR_INVALID_ARG_TYPE,
942
+ StackTraceERR_INVALID_CALLBACK,
943
+ StackTraceERR_OSSL_BAD_DECRYPT,
944
+ StackTraceERR_OSSL_EVP_UNSUPPORTED,
945
+ StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH,
946
+ StackTraceERR_STREAM_DESTROYED,
947
+ StackTraceERR_TLS_CERT_ALTNAME_INVALID,
948
+ StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME,
949
+ StackTraceETIMEDOUT,
701
950
  StackTraceError,
702
951
  StackTraceEvalError,
952
+ StackTraceExit,
703
953
  StackTraceGeneralError,
704
954
  StackTraceOpenSSLError,
705
955
  StackTraceRangeError,
@@ -707,5 +957,7 @@ export {
707
957
  StackTraceSyntaxError,
708
958
  StackTraceSystemError,
709
959
  StackTraceTypeError,
710
- StackTraceURIError
960
+ StackTraceURIError,
961
+ StackTraceUncaughtException,
962
+ StackTraceUnhandledRejection
711
963
  };