opticore-catch-exception-error 1.0.12 → 1.0.14

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