opticore-catch-exception-error 1.0.5 → 1.0.7
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 +11 -10
- package/dist/index.js +11 -10
- package/example/index.ts +5 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -202,6 +202,7 @@ var import_opticore_translator = require("opticore-translator");
|
|
|
202
202
|
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()}`;
|
|
203
203
|
|
|
204
204
|
// src/core/errors/events/serverListen.event.error.ts
|
|
205
|
+
var import_opticore_env_access = require("opticore-env-access");
|
|
205
206
|
var ServerListenEventError = class {
|
|
206
207
|
/**
|
|
207
208
|
*
|
|
@@ -215,7 +216,7 @@ var ServerListenEventError = class {
|
|
|
215
216
|
this.logger.error(
|
|
216
217
|
this.stackTrace.message,
|
|
217
218
|
import_opticore_translator.TranslationLoader.t("webServer", import_opticore_translator.CLocal),
|
|
218
|
-
import_opticore_translator.TranslationLoader.t("
|
|
219
|
+
import_opticore_translator.TranslationLoader.t("badPort", import_opticore_translator.CLocal, { badPort: import_opticore_env_access.getEnvVariable.appPort }),
|
|
219
220
|
this.stackTrace.stack,
|
|
220
221
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
221
222
|
);
|
|
@@ -226,7 +227,7 @@ var ServerListenEventError = class {
|
|
|
226
227
|
*/
|
|
227
228
|
static hostUndefined() {
|
|
228
229
|
this.stackTrace = this.traceError(
|
|
229
|
-
import_opticore_translator.TranslationLoader.t("badHost", import_opticore_translator.CLocal),
|
|
230
|
+
import_opticore_translator.TranslationLoader.t("badHost", import_opticore_translator.CLocal, { badHost: import_opticore_env_access.getEnvVariable.appHost }),
|
|
230
231
|
import_opticore_translator.TranslationLoader.t("listening", import_opticore_translator.CLocal),
|
|
231
232
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
232
233
|
);
|
|
@@ -265,7 +266,7 @@ var ServerListenEventError = class {
|
|
|
265
266
|
this.logger.error(
|
|
266
267
|
import_opticore_translator.TranslationLoader.t(err.message, import_opticore_translator.CLocal),
|
|
267
268
|
import_opticore_translator.TranslationLoader.t("serverStart", import_opticore_translator.CLocal),
|
|
268
|
-
import_opticore_translator.TranslationLoader.t("serverStartError", import_opticore_translator.CLocal),
|
|
269
|
+
import_opticore_translator.TranslationLoader.t("serverStartError", import_opticore_translator.CLocal, { err }),
|
|
269
270
|
err.stack,
|
|
270
271
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
271
272
|
);
|
|
@@ -507,7 +508,7 @@ var ServerListenEventError = class {
|
|
|
507
508
|
try {
|
|
508
509
|
this.stackTrace = this.traceError(
|
|
509
510
|
import_opticore_translator.TranslationLoader.t("promise", import_opticore_translator.CLocal, { promise }),
|
|
510
|
-
import_opticore_translator.TranslationLoader.t("rejectionPromise", import_opticore_translator.CLocal),
|
|
511
|
+
import_opticore_translator.TranslationLoader.t("rejectionPromise", import_opticore_translator.CLocal, { promise }),
|
|
511
512
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
512
513
|
);
|
|
513
514
|
this.logger.error(
|
|
@@ -559,7 +560,7 @@ var ServerListenEventError = class {
|
|
|
559
560
|
static unhandledRejection(reason, promise) {
|
|
560
561
|
this.stackTrace = this.traceError(
|
|
561
562
|
import_opticore_translator.TranslationLoader.t("unhandledRejectionAtPromise", import_opticore_translator.CLocal, { promise, reason }),
|
|
562
|
-
import_opticore_translator.TranslationLoader.t("unhandledRejection", import_opticore_translator.CLocal),
|
|
563
|
+
import_opticore_translator.TranslationLoader.t("unhandledRejection", import_opticore_translator.CLocal, { promise, reason }),
|
|
563
564
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
564
565
|
);
|
|
565
566
|
this.logger.error(
|
|
@@ -582,7 +583,7 @@ var ServerListenEventError = class {
|
|
|
582
583
|
);
|
|
583
584
|
this.logger.error(
|
|
584
585
|
this.stackTrace.message,
|
|
585
|
-
import_opticore_translator.TranslationLoader.t("warning", import_opticore_translator.CLocal),
|
|
586
|
+
import_opticore_translator.TranslationLoader.t("warning", import_opticore_translator.CLocal, { warning }),
|
|
586
587
|
this.stackTrace.name,
|
|
587
588
|
this.stackTrace.stack,
|
|
588
589
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -595,7 +596,7 @@ var ServerListenEventError = class {
|
|
|
595
596
|
static message(message) {
|
|
596
597
|
this.stackTrace = this.traceError(
|
|
597
598
|
import_opticore_translator.TranslationLoader.t("processGotMsg", import_opticore_translator.CLocal, { message }),
|
|
598
|
-
import_opticore_translator.TranslationLoader.t("msgException", import_opticore_translator.CLocal),
|
|
599
|
+
import_opticore_translator.TranslationLoader.t("msgException", import_opticore_translator.CLocal, { message }),
|
|
599
600
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
600
601
|
);
|
|
601
602
|
this.logger.error(
|
|
@@ -615,7 +616,7 @@ var ServerListenEventError = class {
|
|
|
615
616
|
static multipleResolves(type, promise, reason) {
|
|
616
617
|
this.stackTrace = this.traceError(
|
|
617
618
|
import_opticore_translator.TranslationLoader.t("promiseReason", import_opticore_translator.CLocal, { promise, reason }),
|
|
618
|
-
import_opticore_translator.TranslationLoader.t("multipleResolvesDetected", import_opticore_translator.CLocal, { type }),
|
|
619
|
+
import_opticore_translator.TranslationLoader.t("multipleResolvesDetected", import_opticore_translator.CLocal, { type, promise, reason }),
|
|
619
620
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
620
621
|
);
|
|
621
622
|
this.logger.error(
|
|
@@ -713,9 +714,9 @@ ServerListenEventError.logger = new import_opticore_logger.LoggerCore();
|
|
|
713
714
|
// src/core/config/loaders/translateLanguage.loader.ts
|
|
714
715
|
var import_path = __toESM(require("path"), 1);
|
|
715
716
|
var import_opticore_translator2 = require("opticore-translator");
|
|
716
|
-
var
|
|
717
|
+
var import_opticore_env_access2 = require("opticore-env-access");
|
|
717
718
|
var translateCatchExceptionErrorLanguageLoader = () => {
|
|
718
|
-
import_opticore_translator2.TranslationLoader.loadTranslations(import_path.default.join("src", "shared", "translations"),
|
|
719
|
+
import_opticore_translator2.TranslationLoader.loadTranslations(import_path.default.join("src", "shared", "translations"), import_opticore_env_access2.getEnvVariable.defaultLocal);
|
|
719
720
|
};
|
|
720
721
|
// Annotate the CommonJS export names for ESM import in node:
|
|
721
722
|
0 && (module.exports = {
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,7 @@ import { CLocal, TranslationLoader } from "opticore-translator";
|
|
|
151
151
|
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()}`;
|
|
152
152
|
|
|
153
153
|
// src/core/errors/events/serverListen.event.error.ts
|
|
154
|
+
import { getEnvVariable } from "opticore-env-access";
|
|
154
155
|
var ServerListenEventError = class {
|
|
155
156
|
/**
|
|
156
157
|
*
|
|
@@ -164,7 +165,7 @@ var ServerListenEventError = class {
|
|
|
164
165
|
this.logger.error(
|
|
165
166
|
this.stackTrace.message,
|
|
166
167
|
TranslationLoader.t("webServer", CLocal),
|
|
167
|
-
TranslationLoader.t("
|
|
168
|
+
TranslationLoader.t("badPort", CLocal, { badPort: getEnvVariable.appPort }),
|
|
168
169
|
this.stackTrace.stack,
|
|
169
170
|
status11.BAD_REQUEST
|
|
170
171
|
);
|
|
@@ -175,7 +176,7 @@ var ServerListenEventError = class {
|
|
|
175
176
|
*/
|
|
176
177
|
static hostUndefined() {
|
|
177
178
|
this.stackTrace = this.traceError(
|
|
178
|
-
TranslationLoader.t("badHost", CLocal),
|
|
179
|
+
TranslationLoader.t("badHost", CLocal, { badHost: getEnvVariable.appHost }),
|
|
179
180
|
TranslationLoader.t("listening", CLocal),
|
|
180
181
|
status11.BAD_REQUEST
|
|
181
182
|
);
|
|
@@ -214,7 +215,7 @@ var ServerListenEventError = class {
|
|
|
214
215
|
this.logger.error(
|
|
215
216
|
TranslationLoader.t(err.message, CLocal),
|
|
216
217
|
TranslationLoader.t("serverStart", CLocal),
|
|
217
|
-
TranslationLoader.t("serverStartError", CLocal),
|
|
218
|
+
TranslationLoader.t("serverStartError", CLocal, { err }),
|
|
218
219
|
err.stack,
|
|
219
220
|
status11.SERVICE_UNAVAILABLE
|
|
220
221
|
);
|
|
@@ -456,7 +457,7 @@ var ServerListenEventError = class {
|
|
|
456
457
|
try {
|
|
457
458
|
this.stackTrace = this.traceError(
|
|
458
459
|
TranslationLoader.t("promise", CLocal, { promise }),
|
|
459
|
-
TranslationLoader.t("rejectionPromise", CLocal),
|
|
460
|
+
TranslationLoader.t("rejectionPromise", CLocal, { promise }),
|
|
460
461
|
status11.SERVICE_UNAVAILABLE
|
|
461
462
|
);
|
|
462
463
|
this.logger.error(
|
|
@@ -508,7 +509,7 @@ var ServerListenEventError = class {
|
|
|
508
509
|
static unhandledRejection(reason, promise) {
|
|
509
510
|
this.stackTrace = this.traceError(
|
|
510
511
|
TranslationLoader.t("unhandledRejectionAtPromise", CLocal, { promise, reason }),
|
|
511
|
-
TranslationLoader.t("unhandledRejection", CLocal),
|
|
512
|
+
TranslationLoader.t("unhandledRejection", CLocal, { promise, reason }),
|
|
512
513
|
status11.SERVICE_UNAVAILABLE
|
|
513
514
|
);
|
|
514
515
|
this.logger.error(
|
|
@@ -531,7 +532,7 @@ var ServerListenEventError = class {
|
|
|
531
532
|
);
|
|
532
533
|
this.logger.error(
|
|
533
534
|
this.stackTrace.message,
|
|
534
|
-
TranslationLoader.t("warning", CLocal),
|
|
535
|
+
TranslationLoader.t("warning", CLocal, { warning }),
|
|
535
536
|
this.stackTrace.name,
|
|
536
537
|
this.stackTrace.stack,
|
|
537
538
|
status11.SERVICE_UNAVAILABLE
|
|
@@ -544,7 +545,7 @@ var ServerListenEventError = class {
|
|
|
544
545
|
static message(message) {
|
|
545
546
|
this.stackTrace = this.traceError(
|
|
546
547
|
TranslationLoader.t("processGotMsg", CLocal, { message }),
|
|
547
|
-
TranslationLoader.t("msgException", CLocal),
|
|
548
|
+
TranslationLoader.t("msgException", CLocal, { message }),
|
|
548
549
|
status11.SERVICE_UNAVAILABLE
|
|
549
550
|
);
|
|
550
551
|
this.logger.error(
|
|
@@ -564,7 +565,7 @@ var ServerListenEventError = class {
|
|
|
564
565
|
static multipleResolves(type, promise, reason) {
|
|
565
566
|
this.stackTrace = this.traceError(
|
|
566
567
|
TranslationLoader.t("promiseReason", CLocal, { promise, reason }),
|
|
567
|
-
TranslationLoader.t("multipleResolvesDetected", CLocal, { type }),
|
|
568
|
+
TranslationLoader.t("multipleResolvesDetected", CLocal, { type, promise, reason }),
|
|
568
569
|
status11.SERVICE_UNAVAILABLE
|
|
569
570
|
);
|
|
570
571
|
this.logger.error(
|
|
@@ -662,9 +663,9 @@ ServerListenEventError.logger = new LoggerCore();
|
|
|
662
663
|
// src/core/config/loaders/translateLanguage.loader.ts
|
|
663
664
|
import path from "path";
|
|
664
665
|
import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
|
|
665
|
-
import { getEnvVariable } from "opticore-env-access";
|
|
666
|
+
import { getEnvVariable as getEnvVariable2 } from "opticore-env-access";
|
|
666
667
|
var translateCatchExceptionErrorLanguageLoader = () => {
|
|
667
|
-
TranslationLoader2.loadTranslations(path.join("src", "shared", "translations"),
|
|
668
|
+
TranslationLoader2.loadTranslations(path.join("src", "shared", "translations"), getEnvVariable2.defaultLocal);
|
|
668
669
|
};
|
|
669
670
|
export {
|
|
670
671
|
CErrorName,
|
package/example/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {CLocal, TranslationLoader} from "opticore-translator";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
TranslationLoader.loadTranslations(path.join(process.cwd(), 'src','utils', 'translations'));
|
|
5
|
+
console.log(TranslationLoader.t("rejectionPromise", 'en', { promise: "wd digital" }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opticore-catch-exception-error",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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.
|
|
31
|
+
"opticore-translator": "^1.0.3",
|
|
32
32
|
"tsx": "^4.19.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|