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.cjs +114 -102
- package/dist/index.d.cts +33 -18
- package/dist/index.d.ts +33 -18
- package/dist/index.js +115 -103
- package/example/index.ts +2 -2
- package/package.json +2 -2
- package/dist/utils/translations/message.translation.en.json +0 -58
- package/dist/utils/translations/message.translation.fr.json +0 -58
package/dist/index.cjs
CHANGED
|
@@ -207,9 +207,6 @@ var import_opticore_translator2 = require("opticore-translator");
|
|
|
207
207
|
// src/utils/dateTimeFormatted.utils.ts
|
|
208
208
|
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()}`;
|
|
209
209
|
|
|
210
|
-
// src/core/errors/events/serverListen.event.error.ts
|
|
211
|
-
var import_opticore_env_access = require("opticore-env-access");
|
|
212
|
-
|
|
213
210
|
// src/core/config/loaders/translateLanguage.loader.ts
|
|
214
211
|
var import_path = __toESM(require("path"), 1);
|
|
215
212
|
var import_module = require("module");
|
|
@@ -231,17 +228,19 @@ var ServerListenEventError = class {
|
|
|
231
228
|
}
|
|
232
229
|
/**
|
|
233
230
|
*
|
|
231
|
+
* @param defaultLocalLang
|
|
232
|
+
* @param appPort
|
|
234
233
|
*/
|
|
235
|
-
static hostPortUndefined() {
|
|
234
|
+
static hostPortUndefined(defaultLocalLang, appPort) {
|
|
236
235
|
this.stackTrace = this.traceError(
|
|
237
|
-
import_opticore_translator2.TranslationLoader.t("errorHostUrl",
|
|
238
|
-
import_opticore_translator2.TranslationLoader.t("listening",
|
|
236
|
+
import_opticore_translator2.TranslationLoader.t("errorHostUrl", defaultLocalLang),
|
|
237
|
+
import_opticore_translator2.TranslationLoader.t("listening", defaultLocalLang),
|
|
239
238
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
240
239
|
);
|
|
241
240
|
this.logger.error(
|
|
242
241
|
this.stackTrace.message,
|
|
243
|
-
import_opticore_translator2.TranslationLoader.t("webServer",
|
|
244
|
-
import_opticore_translator2.TranslationLoader.t("badPort",
|
|
242
|
+
import_opticore_translator2.TranslationLoader.t("webServer", defaultLocalLang),
|
|
243
|
+
import_opticore_translator2.TranslationLoader.t("badPort", defaultLocalLang, { badPort: appPort }),
|
|
245
244
|
this.stackTrace.stack,
|
|
246
245
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
247
246
|
);
|
|
@@ -249,17 +248,19 @@ var ServerListenEventError = class {
|
|
|
249
248
|
}
|
|
250
249
|
/**
|
|
251
250
|
*
|
|
251
|
+
* @param defaultLocalLang
|
|
252
|
+
* @param appHost
|
|
252
253
|
*/
|
|
253
|
-
static hostUndefined() {
|
|
254
|
+
static hostUndefined(defaultLocalLang, appHost) {
|
|
254
255
|
this.stackTrace = this.traceError(
|
|
255
|
-
import_opticore_translator2.TranslationLoader.t("badHost",
|
|
256
|
-
import_opticore_translator2.TranslationLoader.t("listening",
|
|
256
|
+
import_opticore_translator2.TranslationLoader.t("badHost", defaultLocalLang, { badHost: appHost }),
|
|
257
|
+
import_opticore_translator2.TranslationLoader.t("listening", defaultLocalLang),
|
|
257
258
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
258
259
|
);
|
|
259
260
|
this.logger.error(
|
|
260
261
|
this.stackTrace.message,
|
|
261
|
-
import_opticore_translator2.TranslationLoader.t("webServer",
|
|
262
|
-
import_opticore_translator2.TranslationLoader.t("badHost",
|
|
262
|
+
import_opticore_translator2.TranslationLoader.t("webServer", defaultLocalLang),
|
|
263
|
+
import_opticore_translator2.TranslationLoader.t("badHost", defaultLocalLang),
|
|
263
264
|
this.stackTrace.stack,
|
|
264
265
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
265
266
|
);
|
|
@@ -268,16 +269,16 @@ var ServerListenEventError = class {
|
|
|
268
269
|
/**
|
|
269
270
|
*
|
|
270
271
|
*/
|
|
271
|
-
static portUndefined() {
|
|
272
|
+
static portUndefined(defaultLocalLang) {
|
|
272
273
|
this.stackTrace = this.traceError(
|
|
273
|
-
import_opticore_translator2.TranslationLoader.t("badPort",
|
|
274
|
-
import_opticore_translator2.TranslationLoader.t("listening",
|
|
274
|
+
import_opticore_translator2.TranslationLoader.t("badPort", defaultLocalLang),
|
|
275
|
+
import_opticore_translator2.TranslationLoader.t("listening", defaultLocalLang),
|
|
275
276
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
276
277
|
);
|
|
277
278
|
this.logger.error(
|
|
278
279
|
this.stackTrace.message,
|
|
279
|
-
import_opticore_translator2.TranslationLoader.t("webServer",
|
|
280
|
-
import_opticore_translator2.TranslationLoader.t("badHost",
|
|
280
|
+
import_opticore_translator2.TranslationLoader.t("webServer", defaultLocalLang),
|
|
281
|
+
import_opticore_translator2.TranslationLoader.t("badHost", defaultLocalLang),
|
|
281
282
|
this.stackTrace.stack,
|
|
282
283
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
283
284
|
);
|
|
@@ -286,12 +287,13 @@ var ServerListenEventError = class {
|
|
|
286
287
|
/**
|
|
287
288
|
*
|
|
288
289
|
* @param err
|
|
290
|
+
* @param defaultLocalLang
|
|
289
291
|
*/
|
|
290
|
-
static onEventError(err) {
|
|
292
|
+
static onEventError(err, defaultLocalLang) {
|
|
291
293
|
this.logger.error(
|
|
292
|
-
import_opticore_translator2.TranslationLoader.t(err.message,
|
|
293
|
-
import_opticore_translator2.TranslationLoader.t("serverStart",
|
|
294
|
-
import_opticore_translator2.TranslationLoader.t("serverStartError",
|
|
294
|
+
import_opticore_translator2.TranslationLoader.t(err.message, defaultLocalLang),
|
|
295
|
+
import_opticore_translator2.TranslationLoader.t("serverStart", defaultLocalLang),
|
|
296
|
+
import_opticore_translator2.TranslationLoader.t("serverStartError", defaultLocalLang, { err }),
|
|
295
297
|
err.stack,
|
|
296
298
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
297
299
|
);
|
|
@@ -317,17 +319,18 @@ var ServerListenEventError = class {
|
|
|
317
319
|
/**
|
|
318
320
|
*
|
|
319
321
|
* @param code
|
|
322
|
+
* @param defaultLocalLang
|
|
320
323
|
*/
|
|
321
|
-
static processBeforeExit(code) {
|
|
324
|
+
static processBeforeExit(code, defaultLocalLang) {
|
|
322
325
|
this.stackTrace = this.traceError(
|
|
323
|
-
import_opticore_translator2.TranslationLoader.t("processExitCode",
|
|
324
|
-
import_opticore_translator2.TranslationLoader.t("beforeExit",
|
|
326
|
+
import_opticore_translator2.TranslationLoader.t("processExitCode", defaultLocalLang, { processExitCode: code }),
|
|
327
|
+
import_opticore_translator2.TranslationLoader.t("beforeExit", defaultLocalLang),
|
|
325
328
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
326
329
|
);
|
|
327
330
|
this.logger.error(
|
|
328
331
|
this.stackTrace.message,
|
|
329
|
-
import_opticore_translator2.TranslationLoader.t("beforeExit",
|
|
330
|
-
import_opticore_translator2.TranslationLoader.t("processBeforeExit",
|
|
332
|
+
import_opticore_translator2.TranslationLoader.t("beforeExit", defaultLocalLang),
|
|
333
|
+
import_opticore_translator2.TranslationLoader.t("processBeforeExit", defaultLocalLang),
|
|
331
334
|
this.stackTrace.stack,
|
|
332
335
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
333
336
|
);
|
|
@@ -336,16 +339,16 @@ var ServerListenEventError = class {
|
|
|
336
339
|
/**
|
|
337
340
|
*
|
|
338
341
|
*/
|
|
339
|
-
static processDisconnected() {
|
|
342
|
+
static processDisconnected(defaultLocalLang) {
|
|
340
343
|
this.stackTrace = this.traceError(
|
|
341
|
-
import_opticore_translator2.TranslationLoader.t("childProcessDiscon",
|
|
342
|
-
import_opticore_translator2.TranslationLoader.t("processDiscon",
|
|
344
|
+
import_opticore_translator2.TranslationLoader.t("childProcessDiscon", defaultLocalLang),
|
|
345
|
+
import_opticore_translator2.TranslationLoader.t("processDiscon", defaultLocalLang),
|
|
343
346
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
344
347
|
);
|
|
345
348
|
this.logger.error(
|
|
346
349
|
this.stackTrace.message,
|
|
347
|
-
import_opticore_translator2.TranslationLoader.t("disconnected"),
|
|
348
|
-
import_opticore_translator2.TranslationLoader.t("processDiscon"),
|
|
350
|
+
import_opticore_translator2.TranslationLoader.t("disconnected", defaultLocalLang),
|
|
351
|
+
import_opticore_translator2.TranslationLoader.t("processDiscon", defaultLocalLang),
|
|
349
352
|
this.stackTrace.stack,
|
|
350
353
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
351
354
|
);
|
|
@@ -354,30 +357,31 @@ var ServerListenEventError = class {
|
|
|
354
357
|
/**
|
|
355
358
|
*
|
|
356
359
|
* @param code
|
|
360
|
+
* @param defaultLocalLang
|
|
357
361
|
*/
|
|
358
|
-
static exited(code) {
|
|
362
|
+
static exited(code, defaultLocalLang) {
|
|
359
363
|
switch (code) {
|
|
360
364
|
case 0:
|
|
361
365
|
this.logger.success(
|
|
362
|
-
import_opticore_translator2.TranslationLoader.t("completed",
|
|
363
|
-
import_opticore_translator2.TranslationLoader.t("finishingProcessWell",
|
|
366
|
+
import_opticore_translator2.TranslationLoader.t("completed", defaultLocalLang, { code }),
|
|
367
|
+
import_opticore_translator2.TranslationLoader.t("finishingProcessWell", defaultLocalLang, { code })
|
|
364
368
|
);
|
|
365
369
|
console.log("");
|
|
366
370
|
const paddingLength = 35;
|
|
367
371
|
const msg0 = " ".padEnd(paddingLength, " ");
|
|
368
372
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
369
|
-
console.log(`${import_ansi_colors.default.bgGreen(` ${import_opticore_translator2.TranslationLoader.t("serverStopped",
|
|
373
|
+
console.log(`${import_ansi_colors.default.bgGreen(` ${import_opticore_translator2.TranslationLoader.t("serverStopped", defaultLocalLang)} `)}`);
|
|
370
374
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
371
375
|
break;
|
|
372
376
|
case 1:
|
|
373
377
|
this.stackTrace = this.traceError(
|
|
374
|
-
import_opticore_translator2.TranslationLoader.t("somethingWentWrong",
|
|
375
|
-
import_opticore_translator2.TranslationLoader.t("genErrors",
|
|
378
|
+
import_opticore_translator2.TranslationLoader.t("somethingWentWrong", defaultLocalLang),
|
|
379
|
+
import_opticore_translator2.TranslationLoader.t("genErrors", defaultLocalLang),
|
|
376
380
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
377
381
|
);
|
|
378
382
|
this.logger.error(
|
|
379
383
|
this.stackTrace.message,
|
|
380
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
384
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
381
385
|
"General Errors",
|
|
382
386
|
this.stackTrace.stack,
|
|
383
387
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -385,27 +389,27 @@ var ServerListenEventError = class {
|
|
|
385
389
|
break;
|
|
386
390
|
case 2:
|
|
387
391
|
this.stackTrace = this.traceError(
|
|
388
|
-
import_opticore_translator2.TranslationLoader.t("incorrectCmd",
|
|
389
|
-
import_opticore_translator2.TranslationLoader.t("misuseShell",
|
|
392
|
+
import_opticore_translator2.TranslationLoader.t("incorrectCmd", defaultLocalLang),
|
|
393
|
+
import_opticore_translator2.TranslationLoader.t("misuseShell", defaultLocalLang),
|
|
390
394
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
391
395
|
);
|
|
392
396
|
this.logger.error(
|
|
393
397
|
this.stackTrace.message,
|
|
394
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
395
|
-
import_opticore_translator2.TranslationLoader.t("incorrectCmd",
|
|
398
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
399
|
+
import_opticore_translator2.TranslationLoader.t("incorrectCmd", defaultLocalLang),
|
|
396
400
|
this.stackTrace.stack,
|
|
397
401
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
398
402
|
);
|
|
399
403
|
break;
|
|
400
404
|
case 126:
|
|
401
405
|
this.stackTrace = this.traceError(
|
|
402
|
-
import_opticore_translator2.TranslationLoader.t("incorrectCmd",
|
|
403
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotExecutable",
|
|
406
|
+
import_opticore_translator2.TranslationLoader.t("incorrectCmd", defaultLocalLang),
|
|
407
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotExecutable", defaultLocalLang),
|
|
404
408
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
405
409
|
);
|
|
406
410
|
this.logger.error(
|
|
407
411
|
this.stackTrace.message,
|
|
408
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
412
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
409
413
|
this.stackTrace.name,
|
|
410
414
|
this.stackTrace.stack,
|
|
411
415
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -413,13 +417,13 @@ var ServerListenEventError = class {
|
|
|
413
417
|
break;
|
|
414
418
|
case 127:
|
|
415
419
|
this.stackTrace = this.traceError(
|
|
416
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotFound",
|
|
417
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath",
|
|
420
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotFound", defaultLocalLang),
|
|
421
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath", defaultLocalLang),
|
|
418
422
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
419
423
|
);
|
|
420
424
|
this.logger.error(
|
|
421
425
|
this.stackTrace.message,
|
|
422
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
426
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
423
427
|
this.stackTrace.name,
|
|
424
428
|
this.stackTrace.stack,
|
|
425
429
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -427,13 +431,13 @@ var ServerListenEventError = class {
|
|
|
427
431
|
break;
|
|
428
432
|
case 128:
|
|
429
433
|
this.stackTrace = this.traceError(
|
|
430
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath",
|
|
431
|
-
import_opticore_translator2.TranslationLoader.t("argInvalid",
|
|
434
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath", defaultLocalLang),
|
|
435
|
+
import_opticore_translator2.TranslationLoader.t("argInvalid", defaultLocalLang),
|
|
432
436
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
433
437
|
);
|
|
434
438
|
this.logger.error(
|
|
435
439
|
this.stackTrace.message,
|
|
436
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
440
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
437
441
|
this.stackTrace.name,
|
|
438
442
|
this.stackTrace.stack,
|
|
439
443
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -441,13 +445,13 @@ var ServerListenEventError = class {
|
|
|
441
445
|
break;
|
|
442
446
|
case 130:
|
|
443
447
|
this.stackTrace = this.traceError(
|
|
444
|
-
import_opticore_translator2.TranslationLoader.t("scriptEndedManuallyByCtrlC",
|
|
445
|
-
import_opticore_translator2.TranslationLoader.t("scriptEnded",
|
|
448
|
+
import_opticore_translator2.TranslationLoader.t("scriptEndedManuallyByCtrlC", defaultLocalLang),
|
|
449
|
+
import_opticore_translator2.TranslationLoader.t("scriptEnded", defaultLocalLang),
|
|
446
450
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
447
451
|
);
|
|
448
452
|
this.logger.error(
|
|
449
453
|
this.stackTrace.message,
|
|
450
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
454
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
451
455
|
this.stackTrace.name,
|
|
452
456
|
this.stackTrace.stack,
|
|
453
457
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -455,13 +459,13 @@ var ServerListenEventError = class {
|
|
|
455
459
|
break;
|
|
456
460
|
case 137:
|
|
457
461
|
this.stackTrace = this.traceError(
|
|
458
|
-
import_opticore_translator2.TranslationLoader.t("processEndedBySIGKILL",
|
|
462
|
+
import_opticore_translator2.TranslationLoader.t("processEndedBySIGKILL", defaultLocalLang),
|
|
459
463
|
"SIGKILL",
|
|
460
464
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
461
465
|
);
|
|
462
466
|
this.logger.error(
|
|
463
467
|
this.stackTrace.message,
|
|
464
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
468
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
465
469
|
this.stackTrace.name,
|
|
466
470
|
this.stackTrace.stack,
|
|
467
471
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -469,13 +473,13 @@ var ServerListenEventError = class {
|
|
|
469
473
|
break;
|
|
470
474
|
case 139:
|
|
471
475
|
this.stackTrace = this.traceError(
|
|
472
|
-
import_opticore_translator2.TranslationLoader.t("accessProcessIllegally",
|
|
473
|
-
import_opticore_translator2.TranslationLoader.t("defaultSegment",
|
|
476
|
+
import_opticore_translator2.TranslationLoader.t("accessProcessIllegally", defaultLocalLang),
|
|
477
|
+
import_opticore_translator2.TranslationLoader.t("defaultSegment", defaultLocalLang),
|
|
474
478
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
475
479
|
);
|
|
476
480
|
this.logger.error(
|
|
477
481
|
this.stackTrace.message,
|
|
478
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
482
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
479
483
|
this.stackTrace.name,
|
|
480
484
|
this.stackTrace.stack,
|
|
481
485
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -483,13 +487,13 @@ var ServerListenEventError = class {
|
|
|
483
487
|
break;
|
|
484
488
|
case 143:
|
|
485
489
|
this.stackTrace = this.traceError(
|
|
486
|
-
import_opticore_translator2.TranslationLoader.t("processReceivedSigtermSignal",
|
|
487
|
-
import_opticore_translator2.TranslationLoader.t("processReceived",
|
|
490
|
+
import_opticore_translator2.TranslationLoader.t("processReceivedSigtermSignal", defaultLocalLang),
|
|
491
|
+
import_opticore_translator2.TranslationLoader.t("processReceived", defaultLocalLang),
|
|
488
492
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
489
493
|
);
|
|
490
494
|
this.logger.error(
|
|
491
495
|
this.stackTrace.message,
|
|
492
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
496
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
493
497
|
this.stackTrace.name,
|
|
494
498
|
this.stackTrace.stack,
|
|
495
499
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -497,13 +501,13 @@ var ServerListenEventError = class {
|
|
|
497
501
|
break;
|
|
498
502
|
case 255:
|
|
499
503
|
this.stackTrace = this.traceError(
|
|
500
|
-
import_opticore_translator2.TranslationLoader.t("exitCode",
|
|
501
|
-
import_opticore_translator2.TranslationLoader.t("outRange",
|
|
504
|
+
import_opticore_translator2.TranslationLoader.t("exitCode", defaultLocalLang),
|
|
505
|
+
import_opticore_translator2.TranslationLoader.t("outRange", defaultLocalLang),
|
|
502
506
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
503
507
|
);
|
|
504
508
|
this.logger.error(
|
|
505
509
|
this.stackTrace.message,
|
|
506
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
510
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
507
511
|
this.stackTrace.name,
|
|
508
512
|
this.stackTrace.stack,
|
|
509
513
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -511,13 +515,13 @@ var ServerListenEventError = class {
|
|
|
511
515
|
break;
|
|
512
516
|
default:
|
|
513
517
|
this.stackTrace = this.traceError(
|
|
514
|
-
import_opticore_translator2.TranslationLoader.t("errorOccurring",
|
|
515
|
-
import_opticore_translator2.TranslationLoader.t("errors",
|
|
518
|
+
import_opticore_translator2.TranslationLoader.t("errorOccurring", defaultLocalLang),
|
|
519
|
+
import_opticore_translator2.TranslationLoader.t("errors", defaultLocalLang),
|
|
516
520
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
517
521
|
);
|
|
518
522
|
this.logger.error(
|
|
519
523
|
this.stackTrace.message,
|
|
520
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
524
|
+
import_opticore_translator2.TranslationLoader.t("exited", defaultLocalLang),
|
|
521
525
|
this.stackTrace.name,
|
|
522
526
|
this.stackTrace.stack,
|
|
523
527
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -528,12 +532,13 @@ var ServerListenEventError = class {
|
|
|
528
532
|
/**
|
|
529
533
|
*
|
|
530
534
|
* @param promise
|
|
535
|
+
* @param defaultLocalLang
|
|
531
536
|
*/
|
|
532
|
-
static promiseRejectionHandled(promise) {
|
|
537
|
+
static promiseRejectionHandled(promise, defaultLocalLang) {
|
|
533
538
|
try {
|
|
534
539
|
this.stackTrace = this.traceError(
|
|
535
|
-
import_opticore_translator2.TranslationLoader.t("promise",
|
|
536
|
-
import_opticore_translator2.TranslationLoader.t("rejectionPromise",
|
|
540
|
+
import_opticore_translator2.TranslationLoader.t("promise", defaultLocalLang, { promise }),
|
|
541
|
+
import_opticore_translator2.TranslationLoader.t("rejectionPromise", defaultLocalLang, { promise }),
|
|
537
542
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
538
543
|
);
|
|
539
544
|
this.logger.error(
|
|
@@ -549,14 +554,15 @@ var ServerListenEventError = class {
|
|
|
549
554
|
/**
|
|
550
555
|
*
|
|
551
556
|
* @param error
|
|
557
|
+
* @param defaultLocalLang
|
|
552
558
|
*/
|
|
553
|
-
static uncaughtException(error) {
|
|
559
|
+
static uncaughtException(error, defaultLocalLang) {
|
|
554
560
|
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.") {
|
|
555
561
|
console.log("");
|
|
556
562
|
} else {
|
|
557
563
|
this.stackTrace = this.traceError(
|
|
558
|
-
import_opticore_translator2.TranslationLoader.t(error.message),
|
|
559
|
-
import_opticore_translator2.TranslationLoader.t("uncaughtExceptionHandled",
|
|
564
|
+
import_opticore_translator2.TranslationLoader.t(error.message, defaultLocalLang),
|
|
565
|
+
import_opticore_translator2.TranslationLoader.t("uncaughtExceptionHandled", defaultLocalLang),
|
|
560
566
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
561
567
|
);
|
|
562
568
|
this.logger.error(
|
|
@@ -581,11 +587,12 @@ var ServerListenEventError = class {
|
|
|
581
587
|
*
|
|
582
588
|
* @param reason
|
|
583
589
|
* @param promise
|
|
590
|
+
* @param defaultLocalLang
|
|
584
591
|
*/
|
|
585
|
-
static unhandledRejection(reason, promise) {
|
|
592
|
+
static unhandledRejection(reason, promise, defaultLocalLang) {
|
|
586
593
|
this.stackTrace = this.traceError(
|
|
587
|
-
import_opticore_translator2.TranslationLoader.t("unhandledRejectionAtPromise",
|
|
588
|
-
import_opticore_translator2.TranslationLoader.t("unhandledRejection",
|
|
594
|
+
import_opticore_translator2.TranslationLoader.t("unhandledRejectionAtPromise", defaultLocalLang, { promise, reason }),
|
|
595
|
+
import_opticore_translator2.TranslationLoader.t("unhandledRejection", defaultLocalLang, { promise, reason }),
|
|
589
596
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
590
597
|
);
|
|
591
598
|
this.logger.error(
|
|
@@ -599,16 +606,17 @@ var ServerListenEventError = class {
|
|
|
599
606
|
/**
|
|
600
607
|
*
|
|
601
608
|
* @param warning
|
|
609
|
+
* @param defaultLocalLang
|
|
602
610
|
*/
|
|
603
|
-
static warning(warning) {
|
|
611
|
+
static warning(warning, defaultLocalLang) {
|
|
604
612
|
this.stackTrace = this.traceError(
|
|
605
|
-
import_opticore_translator2.TranslationLoader.t(warning.message,
|
|
613
|
+
import_opticore_translator2.TranslationLoader.t(warning.message, defaultLocalLang),
|
|
606
614
|
"warning",
|
|
607
615
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
608
616
|
);
|
|
609
617
|
this.logger.error(
|
|
610
618
|
this.stackTrace.message,
|
|
611
|
-
import_opticore_translator2.TranslationLoader.t("warning",
|
|
619
|
+
import_opticore_translator2.TranslationLoader.t("warning", defaultLocalLang, { warning }),
|
|
612
620
|
this.stackTrace.name,
|
|
613
621
|
this.stackTrace.stack,
|
|
614
622
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -617,11 +625,12 @@ var ServerListenEventError = class {
|
|
|
617
625
|
/**
|
|
618
626
|
*
|
|
619
627
|
* @param message
|
|
628
|
+
* @param defaultLocalLang
|
|
620
629
|
*/
|
|
621
|
-
static message(message) {
|
|
630
|
+
static message(message, defaultLocalLang) {
|
|
622
631
|
this.stackTrace = this.traceError(
|
|
623
|
-
import_opticore_translator2.TranslationLoader.t("processGotMsg",
|
|
624
|
-
import_opticore_translator2.TranslationLoader.t("msgException",
|
|
632
|
+
import_opticore_translator2.TranslationLoader.t("processGotMsg", defaultLocalLang, { message }),
|
|
633
|
+
import_opticore_translator2.TranslationLoader.t("msgException", defaultLocalLang, { message }),
|
|
625
634
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
626
635
|
);
|
|
627
636
|
this.logger.error(
|
|
@@ -637,11 +646,12 @@ var ServerListenEventError = class {
|
|
|
637
646
|
* @param type
|
|
638
647
|
* @param promise
|
|
639
648
|
* @param reason
|
|
649
|
+
* @param defaultLocalLang
|
|
640
650
|
*/
|
|
641
|
-
static multipleResolves(type, promise, reason) {
|
|
651
|
+
static multipleResolves(type, promise, reason, defaultLocalLang) {
|
|
642
652
|
this.stackTrace = this.traceError(
|
|
643
|
-
import_opticore_translator2.TranslationLoader.t("promiseReason",
|
|
644
|
-
import_opticore_translator2.TranslationLoader.t("multipleResolvesDetected",
|
|
653
|
+
import_opticore_translator2.TranslationLoader.t("promiseReason", defaultLocalLang, { promise, reason }),
|
|
654
|
+
import_opticore_translator2.TranslationLoader.t("multipleResolvesDetected", defaultLocalLang, { type, promise, reason }),
|
|
645
655
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
646
656
|
);
|
|
647
657
|
this.logger.error(
|
|
@@ -655,17 +665,18 @@ var ServerListenEventError = class {
|
|
|
655
665
|
/**
|
|
656
666
|
*
|
|
657
667
|
*/
|
|
658
|
-
static processInterrupted() {
|
|
659
|
-
this.logger.success(import_opticore_translator2.TranslationLoader.t("okSuccess",
|
|
668
|
+
static processInterrupted(defaultLocalLang) {
|
|
669
|
+
this.logger.success(import_opticore_translator2.TranslationLoader.t("okSuccess", defaultLocalLang), import_opticore_translator2.TranslationLoader.t("serverWebStopped", defaultLocalLang));
|
|
660
670
|
import_process.default.exit(0);
|
|
661
671
|
}
|
|
662
672
|
/**
|
|
663
673
|
*
|
|
664
674
|
* @param signal
|
|
675
|
+
* @param defaultLocalLang
|
|
665
676
|
*/
|
|
666
|
-
static sigtermSignalReceived(signal) {
|
|
677
|
+
static sigtermSignalReceived(signal, defaultLocalLang) {
|
|
667
678
|
this.stackTrace = this.traceError(
|
|
668
|
-
import_opticore_translator2.TranslationLoader.t("processPIDReceivedSignal",
|
|
679
|
+
import_opticore_translator2.TranslationLoader.t("processPIDReceivedSignal", defaultLocalLang, { signal: signal.toString() }),
|
|
669
680
|
"SIGTERM",
|
|
670
681
|
import_opticore_http_response11.HttpStatusCode.NOT_ACCEPTABLE
|
|
671
682
|
);
|
|
@@ -681,16 +692,16 @@ var ServerListenEventError = class {
|
|
|
681
692
|
/**
|
|
682
693
|
*
|
|
683
694
|
*/
|
|
684
|
-
static serverClosing() {
|
|
685
|
-
console.log(`${import_ansi_colors.default.bgCyanBright(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(` INFO `)}`)}`)} ${import_opticore_translator2.TranslationLoader.t("allProcessStopped",
|
|
686
|
-
console.log(` ${import_opticore_translator2.TranslationLoader.t("serverClosed",
|
|
695
|
+
static serverClosing(defaultLocalLang) {
|
|
696
|
+
console.log(`${import_ansi_colors.default.bgCyanBright(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(` INFO `)}`)}`)} ${import_opticore_translator2.TranslationLoader.t("allProcessStopped", defaultLocalLang)}`);
|
|
697
|
+
console.log(` ${import_opticore_translator2.TranslationLoader.t("serverClosed", defaultLocalLang)}`);
|
|
687
698
|
import_process.default.exit();
|
|
688
699
|
}
|
|
689
700
|
/**
|
|
690
701
|
*
|
|
691
702
|
*/
|
|
692
|
-
static dropNewConnection() {
|
|
693
|
-
console.log(`${import_ansi_colors.default.cyan(`\u24D8`)} ${import_ansi_colors.default.bgCyan(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(` ${import_opticore_translator2.TranslationLoader.t("serverMaxCon",
|
|
703
|
+
static dropNewConnection(defaultLocalLang) {
|
|
704
|
+
console.log(`${import_ansi_colors.default.cyan(`\u24D8`)} ${import_ansi_colors.default.bgCyan(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(` ${import_opticore_translator2.TranslationLoader.t("serverMaxCon", defaultLocalLang)} `)}`)} `)} ${dateTimeFormatted} | ${import_ansi_colors.default.bgCyan(`${import_ansi_colors.default.white(` Info `)}`)} ${import_opticore_translator2.TranslationLoader.t("serverDroppedCon", defaultLocalLang)}`);
|
|
694
705
|
}
|
|
695
706
|
/**
|
|
696
707
|
*
|
|
@@ -699,29 +710,30 @@ var ServerListenEventError = class {
|
|
|
699
710
|
* @param req
|
|
700
711
|
* @param res
|
|
701
712
|
* @param next
|
|
713
|
+
* @param defaultLocalLang
|
|
702
714
|
*/
|
|
703
|
-
static expressErrorHandlingMiddleware(errorEmitter, err, req, res, next) {
|
|
715
|
+
static expressErrorHandlingMiddleware(errorEmitter, err, req, res, next, defaultLocalLang) {
|
|
704
716
|
if (err) {
|
|
705
717
|
errorEmitter.emit(CEventNameError.error, err);
|
|
706
718
|
if (typeof res.status === "function") {
|
|
707
|
-
res.status(500).send(import_opticore_translator2.TranslationLoader.t("internalServerError",
|
|
719
|
+
res.status(500).send(import_opticore_translator2.TranslationLoader.t("internalServerError", defaultLocalLang, { err }));
|
|
708
720
|
} else {
|
|
709
721
|
this.logger.error(
|
|
710
|
-
import_opticore_translator2.TranslationLoader.t("resStatusNotFunc",
|
|
722
|
+
import_opticore_translator2.TranslationLoader.t("resStatusNotFunc", defaultLocalLang, { err }),
|
|
711
723
|
"response status",
|
|
712
|
-
import_opticore_translator2.TranslationLoader.t("respndNotFunc",
|
|
724
|
+
import_opticore_translator2.TranslationLoader.t("respndNotFunc", defaultLocalLang, { err }),
|
|
713
725
|
err.stack,
|
|
714
726
|
import_opticore_http_response11.HttpStatusCode.NOT_ACCEPTABLE
|
|
715
727
|
);
|
|
716
728
|
}
|
|
717
729
|
this.stackTrace = this.traceError(
|
|
718
730
|
err.message,
|
|
719
|
-
import_opticore_translator2.TranslationLoader.t("expressError",
|
|
731
|
+
import_opticore_translator2.TranslationLoader.t("expressError", defaultLocalLang, { err }),
|
|
720
732
|
import_opticore_http_response11.HttpStatusCode.NOT_ACCEPTABLE
|
|
721
733
|
);
|
|
722
734
|
this.logger.error(
|
|
723
735
|
this.stackTrace.message,
|
|
724
|
-
import_opticore_translator2.TranslationLoader.t("expressErrorHandlingMiddleware",
|
|
736
|
+
import_opticore_translator2.TranslationLoader.t("expressErrorHandlingMiddleware", defaultLocalLang, { err }),
|
|
725
737
|
this.stackTrace.name,
|
|
726
738
|
this.stackTrace.stack,
|
|
727
739
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|