opticore-catch-exception-error 1.0.12 → 1.0.13

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
@@ -148,14 +148,11 @@ import colors from "ansi-colors";
148
148
  import chalk from "chalk";
149
149
  import { LoggerCore } from "opticore-logger";
150
150
  import { HttpStatusCode as status11 } from "opticore-http-response";
151
- import { CLocal, TranslationLoader as TranslationLoader2 } from "opticore-translator";
151
+ import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
152
152
 
153
153
  // src/utils/dateTimeFormatted.utils.ts
154
154
  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
155
 
156
- // src/core/errors/events/serverListen.event.error.ts
157
- import { getEnvVariable } from "opticore-env-access";
158
-
159
156
  // src/core/config/loaders/translateLanguage.loader.ts
160
157
  import path from "path";
161
158
  import { createRequire } from "module";
@@ -177,17 +174,19 @@ var ServerListenEventError = class {
177
174
  }
178
175
  /**
179
176
  *
177
+ * @param defaultLocalLang
178
+ * @param appPort
180
179
  */
181
- static hostPortUndefined() {
180
+ static hostPortUndefined(defaultLocalLang, appPort) {
182
181
  this.stackTrace = this.traceError(
183
- TranslationLoader2.t("errorHostUrl", CLocal),
184
- TranslationLoader2.t("listening", CLocal),
182
+ TranslationLoader2.t("errorHostUrl", defaultLocalLang),
183
+ TranslationLoader2.t("listening", defaultLocalLang),
185
184
  status11.BAD_REQUEST
186
185
  );
187
186
  this.logger.error(
188
187
  this.stackTrace.message,
189
- TranslationLoader2.t("webServer", CLocal),
190
- TranslationLoader2.t("badPort", CLocal, { badPort: getEnvVariable.appPort }),
188
+ TranslationLoader2.t("webServer", defaultLocalLang),
189
+ TranslationLoader2.t("badPort", defaultLocalLang, { badPort: appPort }),
191
190
  this.stackTrace.stack,
192
191
  status11.BAD_REQUEST
193
192
  );
@@ -195,17 +194,19 @@ var ServerListenEventError = class {
195
194
  }
196
195
  /**
197
196
  *
197
+ * @param defaultLocalLang
198
+ * @param appHost
198
199
  */
199
- static hostUndefined() {
200
+ static hostUndefined(defaultLocalLang, appHost) {
200
201
  this.stackTrace = this.traceError(
201
- TranslationLoader2.t("badHost", CLocal, { badHost: getEnvVariable.appHost }),
202
- TranslationLoader2.t("listening", CLocal),
202
+ TranslationLoader2.t("badHost", defaultLocalLang, { badHost: appHost }),
203
+ TranslationLoader2.t("listening", defaultLocalLang),
203
204
  status11.BAD_REQUEST
204
205
  );
205
206
  this.logger.error(
206
207
  this.stackTrace.message,
207
- TranslationLoader2.t("webServer", CLocal),
208
- TranslationLoader2.t("badHost", CLocal),
208
+ TranslationLoader2.t("webServer", defaultLocalLang),
209
+ TranslationLoader2.t("badHost", defaultLocalLang),
209
210
  this.stackTrace.stack,
210
211
  status11.BAD_REQUEST
211
212
  );
@@ -214,16 +215,16 @@ var ServerListenEventError = class {
214
215
  /**
215
216
  *
216
217
  */
217
- static portUndefined() {
218
+ static portUndefined(defaultLocalLang) {
218
219
  this.stackTrace = this.traceError(
219
- TranslationLoader2.t("badPort", CLocal),
220
- TranslationLoader2.t("listening", CLocal),
220
+ TranslationLoader2.t("badPort", defaultLocalLang),
221
+ TranslationLoader2.t("listening", defaultLocalLang),
221
222
  status11.BAD_REQUEST
222
223
  );
223
224
  this.logger.error(
224
225
  this.stackTrace.message,
225
- TranslationLoader2.t("webServer", CLocal),
226
- TranslationLoader2.t("badHost", CLocal),
226
+ TranslationLoader2.t("webServer", defaultLocalLang),
227
+ TranslationLoader2.t("badHost", defaultLocalLang),
227
228
  this.stackTrace.stack,
228
229
  status11.BAD_REQUEST
229
230
  );
@@ -232,12 +233,13 @@ var ServerListenEventError = class {
232
233
  /**
233
234
  *
234
235
  * @param err
236
+ * @param defaultLocalLang
235
237
  */
236
- static onEventError(err) {
238
+ static onEventError(err, defaultLocalLang) {
237
239
  this.logger.error(
238
- TranslationLoader2.t(err.message, CLocal),
239
- TranslationLoader2.t("serverStart", CLocal),
240
- TranslationLoader2.t("serverStartError", CLocal, { err }),
240
+ TranslationLoader2.t(err.message, defaultLocalLang),
241
+ TranslationLoader2.t("serverStart", defaultLocalLang),
242
+ TranslationLoader2.t("serverStartError", defaultLocalLang, { err }),
241
243
  err.stack,
242
244
  status11.SERVICE_UNAVAILABLE
243
245
  );
@@ -263,17 +265,18 @@ var ServerListenEventError = class {
263
265
  /**
264
266
  *
265
267
  * @param code
268
+ * @param defaultLocalLang
266
269
  */
267
- static processBeforeExit(code) {
270
+ static processBeforeExit(code, defaultLocalLang) {
268
271
  this.stackTrace = this.traceError(
269
- TranslationLoader2.t("processExitCode", CLocal, { processExitCode: code }),
270
- TranslationLoader2.t("beforeExit", CLocal),
272
+ TranslationLoader2.t("processExitCode", defaultLocalLang, { processExitCode: code }),
273
+ TranslationLoader2.t("beforeExit", defaultLocalLang),
271
274
  status11.SERVICE_UNAVAILABLE
272
275
  );
273
276
  this.logger.error(
274
277
  this.stackTrace.message,
275
- TranslationLoader2.t("beforeExit", CLocal),
276
- TranslationLoader2.t("processBeforeExit", CLocal),
278
+ TranslationLoader2.t("beforeExit", defaultLocalLang),
279
+ TranslationLoader2.t("processBeforeExit", defaultLocalLang),
277
280
  this.stackTrace.stack,
278
281
  status11.SERVICE_UNAVAILABLE
279
282
  );
@@ -282,16 +285,16 @@ var ServerListenEventError = class {
282
285
  /**
283
286
  *
284
287
  */
285
- static processDisconnected() {
288
+ static processDisconnected(defaultLocalLang) {
286
289
  this.stackTrace = this.traceError(
287
- TranslationLoader2.t("childProcessDiscon", CLocal),
288
- TranslationLoader2.t("processDiscon", CLocal),
290
+ TranslationLoader2.t("childProcessDiscon", defaultLocalLang),
291
+ TranslationLoader2.t("processDiscon", defaultLocalLang),
289
292
  status11.SERVICE_UNAVAILABLE
290
293
  );
291
294
  this.logger.error(
292
295
  this.stackTrace.message,
293
- TranslationLoader2.t("disconnected"),
294
- TranslationLoader2.t("processDiscon"),
296
+ TranslationLoader2.t("disconnected", defaultLocalLang),
297
+ TranslationLoader2.t("processDiscon", defaultLocalLang),
295
298
  this.stackTrace.stack,
296
299
  status11.SERVICE_UNAVAILABLE
297
300
  );
@@ -300,30 +303,31 @@ var ServerListenEventError = class {
300
303
  /**
301
304
  *
302
305
  * @param code
306
+ * @param defaultLocalLang
303
307
  */
304
- static exited(code) {
308
+ static exited(code, defaultLocalLang) {
305
309
  switch (code) {
306
310
  case 0:
307
311
  this.logger.success(
308
- TranslationLoader2.t("completed", CLocal, { code }),
309
- TranslationLoader2.t("finishingProcessWell", CLocal, { code })
312
+ TranslationLoader2.t("completed", defaultLocalLang, { code }),
313
+ TranslationLoader2.t("finishingProcessWell", defaultLocalLang, { code })
310
314
  );
311
315
  console.log("");
312
316
  const paddingLength = 35;
313
317
  const msg0 = " ".padEnd(paddingLength, " ");
314
318
  console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
315
- console.log(`${colors.bgGreen(` ${TranslationLoader2.t("serverStopped", CLocal)} `)}`);
319
+ console.log(`${colors.bgGreen(` ${TranslationLoader2.t("serverStopped", defaultLocalLang)} `)}`);
316
320
  console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
317
321
  break;
318
322
  case 1:
319
323
  this.stackTrace = this.traceError(
320
- TranslationLoader2.t("somethingWentWrong", CLocal),
321
- TranslationLoader2.t("genErrors", CLocal),
324
+ TranslationLoader2.t("somethingWentWrong", defaultLocalLang),
325
+ TranslationLoader2.t("genErrors", defaultLocalLang),
322
326
  status11.SERVICE_UNAVAILABLE
323
327
  );
324
328
  this.logger.error(
325
329
  this.stackTrace.message,
326
- TranslationLoader2.t("exited", CLocal),
330
+ TranslationLoader2.t("exited", defaultLocalLang),
327
331
  "General Errors",
328
332
  this.stackTrace.stack,
329
333
  status11.SERVICE_UNAVAILABLE
@@ -331,27 +335,27 @@ var ServerListenEventError = class {
331
335
  break;
332
336
  case 2:
333
337
  this.stackTrace = this.traceError(
334
- TranslationLoader2.t("incorrectCmd", CLocal),
335
- TranslationLoader2.t("misuseShell", CLocal),
338
+ TranslationLoader2.t("incorrectCmd", defaultLocalLang),
339
+ TranslationLoader2.t("misuseShell", defaultLocalLang),
336
340
  status11.SERVICE_UNAVAILABLE
337
341
  );
338
342
  this.logger.error(
339
343
  this.stackTrace.message,
340
- TranslationLoader2.t("exited", CLocal),
341
- TranslationLoader2.t("incorrectCmd", CLocal),
344
+ TranslationLoader2.t("exited", defaultLocalLang),
345
+ TranslationLoader2.t("incorrectCmd", defaultLocalLang),
342
346
  this.stackTrace.stack,
343
347
  status11.SERVICE_UNAVAILABLE
344
348
  );
345
349
  break;
346
350
  case 126:
347
351
  this.stackTrace = this.traceError(
348
- TranslationLoader2.t("incorrectCmd", CLocal),
349
- TranslationLoader2.t("cmdNotExecutable", CLocal),
352
+ TranslationLoader2.t("incorrectCmd", defaultLocalLang),
353
+ TranslationLoader2.t("cmdNotExecutable", defaultLocalLang),
350
354
  status11.SERVICE_UNAVAILABLE
351
355
  );
352
356
  this.logger.error(
353
357
  this.stackTrace.message,
354
- TranslationLoader2.t("exited", CLocal),
358
+ TranslationLoader2.t("exited", defaultLocalLang),
355
359
  this.stackTrace.name,
356
360
  this.stackTrace.stack,
357
361
  status11.SERVICE_UNAVAILABLE
@@ -359,13 +363,13 @@ var ServerListenEventError = class {
359
363
  break;
360
364
  case 127:
361
365
  this.stackTrace = this.traceError(
362
- TranslationLoader2.t("cmdNotFound", CLocal),
363
- TranslationLoader2.t("cmdNotFoundInSystemPath", CLocal),
366
+ TranslationLoader2.t("cmdNotFound", defaultLocalLang),
367
+ TranslationLoader2.t("cmdNotFoundInSystemPath", defaultLocalLang),
364
368
  status11.SERVICE_UNAVAILABLE
365
369
  );
366
370
  this.logger.error(
367
371
  this.stackTrace.message,
368
- TranslationLoader2.t("exited", CLocal),
372
+ TranslationLoader2.t("exited", defaultLocalLang),
369
373
  this.stackTrace.name,
370
374
  this.stackTrace.stack,
371
375
  status11.SERVICE_UNAVAILABLE
@@ -373,13 +377,13 @@ var ServerListenEventError = class {
373
377
  break;
374
378
  case 128:
375
379
  this.stackTrace = this.traceError(
376
- TranslationLoader2.t("cmdNotFoundInSystemPath", CLocal),
377
- TranslationLoader2.t("argInvalid", CLocal),
380
+ TranslationLoader2.t("cmdNotFoundInSystemPath", defaultLocalLang),
381
+ TranslationLoader2.t("argInvalid", defaultLocalLang),
378
382
  status11.SERVICE_UNAVAILABLE
379
383
  );
380
384
  this.logger.error(
381
385
  this.stackTrace.message,
382
- TranslationLoader2.t("exited", CLocal),
386
+ TranslationLoader2.t("exited", defaultLocalLang),
383
387
  this.stackTrace.name,
384
388
  this.stackTrace.stack,
385
389
  status11.SERVICE_UNAVAILABLE
@@ -387,13 +391,13 @@ var ServerListenEventError = class {
387
391
  break;
388
392
  case 130:
389
393
  this.stackTrace = this.traceError(
390
- TranslationLoader2.t("scriptEndedManuallyByCtrlC", CLocal),
391
- TranslationLoader2.t("scriptEnded", CLocal),
394
+ TranslationLoader2.t("scriptEndedManuallyByCtrlC", defaultLocalLang),
395
+ TranslationLoader2.t("scriptEnded", defaultLocalLang),
392
396
  status11.SERVICE_UNAVAILABLE
393
397
  );
394
398
  this.logger.error(
395
399
  this.stackTrace.message,
396
- TranslationLoader2.t("exited", CLocal),
400
+ TranslationLoader2.t("exited", defaultLocalLang),
397
401
  this.stackTrace.name,
398
402
  this.stackTrace.stack,
399
403
  status11.SERVICE_UNAVAILABLE
@@ -401,13 +405,13 @@ var ServerListenEventError = class {
401
405
  break;
402
406
  case 137:
403
407
  this.stackTrace = this.traceError(
404
- TranslationLoader2.t("processEndedBySIGKILL", CLocal),
408
+ TranslationLoader2.t("processEndedBySIGKILL", defaultLocalLang),
405
409
  "SIGKILL",
406
410
  status11.SERVICE_UNAVAILABLE
407
411
  );
408
412
  this.logger.error(
409
413
  this.stackTrace.message,
410
- TranslationLoader2.t("exited", CLocal),
414
+ TranslationLoader2.t("exited", defaultLocalLang),
411
415
  this.stackTrace.name,
412
416
  this.stackTrace.stack,
413
417
  status11.SERVICE_UNAVAILABLE
@@ -415,13 +419,13 @@ var ServerListenEventError = class {
415
419
  break;
416
420
  case 139:
417
421
  this.stackTrace = this.traceError(
418
- TranslationLoader2.t("accessProcessIllegally", CLocal),
419
- TranslationLoader2.t("defaultSegment", CLocal),
422
+ TranslationLoader2.t("accessProcessIllegally", defaultLocalLang),
423
+ TranslationLoader2.t("defaultSegment", defaultLocalLang),
420
424
  status11.SERVICE_UNAVAILABLE
421
425
  );
422
426
  this.logger.error(
423
427
  this.stackTrace.message,
424
- TranslationLoader2.t("exited", CLocal),
428
+ TranslationLoader2.t("exited", defaultLocalLang),
425
429
  this.stackTrace.name,
426
430
  this.stackTrace.stack,
427
431
  status11.SERVICE_UNAVAILABLE
@@ -429,13 +433,13 @@ var ServerListenEventError = class {
429
433
  break;
430
434
  case 143:
431
435
  this.stackTrace = this.traceError(
432
- TranslationLoader2.t("processReceivedSigtermSignal", CLocal),
433
- TranslationLoader2.t("processReceived", CLocal),
436
+ TranslationLoader2.t("processReceivedSigtermSignal", defaultLocalLang),
437
+ TranslationLoader2.t("processReceived", defaultLocalLang),
434
438
  status11.SERVICE_UNAVAILABLE
435
439
  );
436
440
  this.logger.error(
437
441
  this.stackTrace.message,
438
- TranslationLoader2.t("exited", CLocal),
442
+ TranslationLoader2.t("exited", defaultLocalLang),
439
443
  this.stackTrace.name,
440
444
  this.stackTrace.stack,
441
445
  status11.SERVICE_UNAVAILABLE
@@ -443,13 +447,13 @@ var ServerListenEventError = class {
443
447
  break;
444
448
  case 255:
445
449
  this.stackTrace = this.traceError(
446
- TranslationLoader2.t("exitCode", CLocal),
447
- TranslationLoader2.t("outRange", CLocal),
450
+ TranslationLoader2.t("exitCode", defaultLocalLang),
451
+ TranslationLoader2.t("outRange", defaultLocalLang),
448
452
  status11.SERVICE_UNAVAILABLE
449
453
  );
450
454
  this.logger.error(
451
455
  this.stackTrace.message,
452
- TranslationLoader2.t("exited", CLocal),
456
+ TranslationLoader2.t("exited", defaultLocalLang),
453
457
  this.stackTrace.name,
454
458
  this.stackTrace.stack,
455
459
  status11.SERVICE_UNAVAILABLE
@@ -457,13 +461,13 @@ var ServerListenEventError = class {
457
461
  break;
458
462
  default:
459
463
  this.stackTrace = this.traceError(
460
- TranslationLoader2.t("errorOccurring", CLocal),
461
- TranslationLoader2.t("errors", CLocal),
464
+ TranslationLoader2.t("errorOccurring", defaultLocalLang),
465
+ TranslationLoader2.t("errors", defaultLocalLang),
462
466
  status11.SERVICE_UNAVAILABLE
463
467
  );
464
468
  this.logger.error(
465
469
  this.stackTrace.message,
466
- TranslationLoader2.t("exited", CLocal),
470
+ TranslationLoader2.t("exited", defaultLocalLang),
467
471
  this.stackTrace.name,
468
472
  this.stackTrace.stack,
469
473
  status11.SERVICE_UNAVAILABLE
@@ -474,12 +478,13 @@ var ServerListenEventError = class {
474
478
  /**
475
479
  *
476
480
  * @param promise
481
+ * @param defaultLocalLang
477
482
  */
478
- static promiseRejectionHandled(promise) {
483
+ static promiseRejectionHandled(promise, defaultLocalLang) {
479
484
  try {
480
485
  this.stackTrace = this.traceError(
481
- TranslationLoader2.t("promise", CLocal, { promise }),
482
- TranslationLoader2.t("rejectionPromise", CLocal, { promise }),
486
+ TranslationLoader2.t("promise", defaultLocalLang, { promise }),
487
+ TranslationLoader2.t("rejectionPromise", defaultLocalLang, { promise }),
483
488
  status11.SERVICE_UNAVAILABLE
484
489
  );
485
490
  this.logger.error(
@@ -495,14 +500,15 @@ var ServerListenEventError = class {
495
500
  /**
496
501
  *
497
502
  * @param error
503
+ * @param defaultLocalLang
498
504
  */
499
- static uncaughtException(error) {
505
+ static uncaughtException(error, defaultLocalLang) {
500
506
  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
507
  console.log("");
502
508
  } else {
503
509
  this.stackTrace = this.traceError(
504
- TranslationLoader2.t(error.message),
505
- TranslationLoader2.t("uncaughtExceptionHandled", CLocal),
510
+ TranslationLoader2.t(error.message, defaultLocalLang),
511
+ TranslationLoader2.t("uncaughtExceptionHandled", defaultLocalLang),
506
512
  status11.SERVICE_UNAVAILABLE
507
513
  );
508
514
  this.logger.error(
@@ -527,11 +533,12 @@ var ServerListenEventError = class {
527
533
  *
528
534
  * @param reason
529
535
  * @param promise
536
+ * @param defaultLocalLang
530
537
  */
531
- static unhandledRejection(reason, promise) {
538
+ static unhandledRejection(reason, promise, defaultLocalLang) {
532
539
  this.stackTrace = this.traceError(
533
- TranslationLoader2.t("unhandledRejectionAtPromise", CLocal, { promise, reason }),
534
- TranslationLoader2.t("unhandledRejection", CLocal, { promise, reason }),
540
+ TranslationLoader2.t("unhandledRejectionAtPromise", defaultLocalLang, { promise, reason }),
541
+ TranslationLoader2.t("unhandledRejection", defaultLocalLang, { promise, reason }),
535
542
  status11.SERVICE_UNAVAILABLE
536
543
  );
537
544
  this.logger.error(
@@ -545,16 +552,17 @@ var ServerListenEventError = class {
545
552
  /**
546
553
  *
547
554
  * @param warning
555
+ * @param defaultLocalLang
548
556
  */
549
- static warning(warning) {
557
+ static warning(warning, defaultLocalLang) {
550
558
  this.stackTrace = this.traceError(
551
- TranslationLoader2.t(warning.message, CLocal),
559
+ TranslationLoader2.t(warning.message, defaultLocalLang),
552
560
  "warning",
553
561
  status11.SERVICE_UNAVAILABLE
554
562
  );
555
563
  this.logger.error(
556
564
  this.stackTrace.message,
557
- TranslationLoader2.t("warning", CLocal, { warning }),
565
+ TranslationLoader2.t("warning", defaultLocalLang, { warning }),
558
566
  this.stackTrace.name,
559
567
  this.stackTrace.stack,
560
568
  status11.SERVICE_UNAVAILABLE
@@ -563,11 +571,12 @@ var ServerListenEventError = class {
563
571
  /**
564
572
  *
565
573
  * @param message
574
+ * @param defaultLocalLang
566
575
  */
567
- static message(message) {
576
+ static message(message, defaultLocalLang) {
568
577
  this.stackTrace = this.traceError(
569
- TranslationLoader2.t("processGotMsg", CLocal, { message }),
570
- TranslationLoader2.t("msgException", CLocal, { message }),
578
+ TranslationLoader2.t("processGotMsg", defaultLocalLang, { message }),
579
+ TranslationLoader2.t("msgException", defaultLocalLang, { message }),
571
580
  status11.SERVICE_UNAVAILABLE
572
581
  );
573
582
  this.logger.error(
@@ -583,11 +592,12 @@ var ServerListenEventError = class {
583
592
  * @param type
584
593
  * @param promise
585
594
  * @param reason
595
+ * @param defaultLocalLang
586
596
  */
587
- static multipleResolves(type, promise, reason) {
597
+ static multipleResolves(type, promise, reason, defaultLocalLang) {
588
598
  this.stackTrace = this.traceError(
589
- TranslationLoader2.t("promiseReason", CLocal, { promise, reason }),
590
- TranslationLoader2.t("multipleResolvesDetected", CLocal, { type, promise, reason }),
599
+ TranslationLoader2.t("promiseReason", defaultLocalLang, { promise, reason }),
600
+ TranslationLoader2.t("multipleResolvesDetected", defaultLocalLang, { type, promise, reason }),
591
601
  status11.SERVICE_UNAVAILABLE
592
602
  );
593
603
  this.logger.error(
@@ -601,17 +611,18 @@ var ServerListenEventError = class {
601
611
  /**
602
612
  *
603
613
  */
604
- static processInterrupted() {
605
- this.logger.success(TranslationLoader2.t("okSuccess", CLocal), TranslationLoader2.t("serverWebStopped", CLocal));
614
+ static processInterrupted(defaultLocalLang) {
615
+ this.logger.success(TranslationLoader2.t("okSuccess", defaultLocalLang), TranslationLoader2.t("serverWebStopped", defaultLocalLang));
606
616
  process.exit(0);
607
617
  }
608
618
  /**
609
619
  *
610
620
  * @param signal
621
+ * @param defaultLocalLang
611
622
  */
612
- static sigtermSignalReceived(signal) {
623
+ static sigtermSignalReceived(signal, defaultLocalLang) {
613
624
  this.stackTrace = this.traceError(
614
- TranslationLoader2.t("processPIDReceivedSignal", CLocal, { signal: signal.toString() }),
625
+ TranslationLoader2.t("processPIDReceivedSignal", defaultLocalLang, { signal: signal.toString() }),
615
626
  "SIGTERM",
616
627
  status11.NOT_ACCEPTABLE
617
628
  );
@@ -627,16 +638,16 @@ var ServerListenEventError = class {
627
638
  /**
628
639
  *
629
640
  */
630
- static serverClosing() {
631
- console.log(`${colors.bgCyanBright(` ${colors.bold(`${colors.white(` INFO `)}`)}`)} ${TranslationLoader2.t("allProcessStopped", CLocal)}`);
632
- console.log(` ${TranslationLoader2.t("serverClosed", CLocal)}`);
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)}`);
633
644
  process.exit();
634
645
  }
635
646
  /**
636
647
  *
637
648
  */
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)}`);
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)}`);
640
651
  }
641
652
  /**
642
653
  *
@@ -645,29 +656,30 @@ var ServerListenEventError = class {
645
656
  * @param req
646
657
  * @param res
647
658
  * @param next
659
+ * @param defaultLocalLang
648
660
  */
649
- static expressErrorHandlingMiddleware(errorEmitter, err, req, res, next) {
661
+ static expressErrorHandlingMiddleware(errorEmitter, err, req, res, next, defaultLocalLang) {
650
662
  if (err) {
651
663
  errorEmitter.emit(CEventNameError.error, err);
652
664
  if (typeof res.status === "function") {
653
- res.status(500).send(TranslationLoader2.t("internalServerError", CLocal, { err }));
665
+ res.status(500).send(TranslationLoader2.t("internalServerError", defaultLocalLang, { err }));
654
666
  } else {
655
667
  this.logger.error(
656
- TranslationLoader2.t("resStatusNotFunc", CLocal, { err }),
668
+ TranslationLoader2.t("resStatusNotFunc", defaultLocalLang, { err }),
657
669
  "response status",
658
- TranslationLoader2.t("respndNotFunc", CLocal, { err }),
670
+ TranslationLoader2.t("respndNotFunc", defaultLocalLang, { err }),
659
671
  err.stack,
660
672
  status11.NOT_ACCEPTABLE
661
673
  );
662
674
  }
663
675
  this.stackTrace = this.traceError(
664
676
  err.message,
665
- TranslationLoader2.t("expressError", CLocal, { err }),
677
+ TranslationLoader2.t("expressError", defaultLocalLang, { err }),
666
678
  status11.NOT_ACCEPTABLE
667
679
  );
668
680
  this.logger.error(
669
681
  this.stackTrace.message,
670
- TranslationLoader2.t("expressErrorHandlingMiddleware", CLocal, { err }),
682
+ TranslationLoader2.t("expressErrorHandlingMiddleware", defaultLocalLang, { err }),
671
683
  this.stackTrace.name,
672
684
  this.stackTrace.stack,
673
685
  status11.SERVICE_UNAVAILABLE
package/example/index.ts CHANGED
@@ -15,6 +15,6 @@ console.log("__filename is : ", __filename);
15
15
  // Obtenir le répertoire du fichier
16
16
  (() => {
17
17
  const __dirname = path.dirname(__filename);
18
- const server = ServerListenEventError.__init();
19
- server.hostPortUndefined();
18
+ const server = ServerListenEventError;
19
+ server.hostPortUndefined("en");
20
20
  })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opticore-catch-exception-error",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "opticore catch exception error",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "chalk": "^5.4.1",
29
29
  "opticore-express": "^1.0.3",
30
30
  "opticore-http-response": "^1.0.3",
31
- "opticore-translator": "^1.0.3",
31
+ "opticore-translator": "^1.0.7",
32
32
  "tsx": "^4.19.3"
33
33
  },
34
34
  "devDependencies": {
@@ -1,58 +0,0 @@
1
- {
2
- "errorHostUrl": "The host and port are not define, please define them in .env",
3
- "listening": "listening",
4
- "webServer": "Web server",
5
- "webHost": "host",
6
- "hostNotFound": "not found",
7
- "badHost": "bad host {badHost}",
8
- "badPort": "bad port {badPort}",
9
- "errorPort": "The port is not correct. Please define a right port with number port.",
10
- "errorHost": "The host can't be empty or blank. Please define a string host in .env",
11
- "serverStart": "Server start",
12
- "serverStartError": "Server start with error {err}",
13
- "processExitCode": "Process will exit with code: {code}",
14
- "beforeExit": "BeforeExit",
15
- "childProcessDiscon": "Child process disconnected",
16
- "processDiscon": "process disconnected",
17
- "completed": "completed with code {code}",
18
- "finishingProcessWell": "The process is finishing well with code {code}",
19
- "serverStopped": "[OK] The server shutting down",
20
- "somethingWentWrong": "Something went wrong",
21
- "genErrors": "General Errors",
22
- "exited": "Exited",
23
- "incorrectCmd": "Incorrect using of shell commands",
24
- "misuseShell": "Misuse of shell builtins",
25
- "cmdNotExecutable": "The command is found but is not executable (e.g., trying to execute a directory)",
26
- "cmdNotFound": "Command not found",
27
- "cmdNotFoundInSystemPath": "The command was not found in the system's PATH or is misspelled",
28
- "argInvalid": "Invalid argument",
29
- "scriptEndedManuallyByCtrlC": "Indicates that the script was manually terminated by the user using the Control-C (SIGINT) signal",
30
- "scriptEnded": "Script terminated",
31
- "processEndedBySIGKILL": "Indicates that the process was terminated by a SIGKILL signal, possibly due to an out-of-memory situation",
32
- "accessProcessIllegally": "Indicates that the process accessed an illegal memory address (segfault)",
33
- "defaultSegment": "Segmentation fault",
34
- "processReceivedSigtermSignal": "Indicates that the process received a SIGTERM signal to terminate",
35
- "processReceived": "process received a SIGTERM",
36
- "exitCode": "An exit code that is outside the allowable range (0-255 for Unix-like systems)",
37
- "outRange": "out of range",
38
- "errorOccurring": "Error is occurring",
39
- "errors": "errors",
40
- "warning": "Warning {warning}",
41
- "promiseRejectionHandled": "Promise rejection is handled at : {promise}",
42
- "rejectionPromise": "rejection promise {promise}",
43
- "uncaughtExceptionHandled": "uncaught exception handled",
44
- "unhandledRejectionAtPromise": "Unhandled Rejection at: Promise {promise} -- reason {reason}",
45
- "unhandledRejection": "Unhandled rejection at: Promise {promise} -- reason {reason}",
46
- "processGotMsg": "process got message {message}",
47
- "msgException": "message exception {}",
48
- "promiseReason": "{promise} -- {reason}",
49
- "multipleResolvesDetected": "Multiple resolves detected : {type}",
50
- "okSuccess": "[ OK ] Success",
51
- "processPIDReceivedSignal": "Process ${process.pid} received a SIGTERM signal : {signal} {promise} -- {reason}",
52
- "allProcessStopped": "All processes are stopped",
53
- "internalServerError": "Internal Server Error : {err}",
54
- "resStatusNotFunc": "res.status is not a function {err}",
55
- "respndNotFunc": "response not Function {err}",
56
- "expressErrorHandlingMiddleware": "Express error-handling middleware {err}",
57
- "expressError": "Express error {err}"
58
- }