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