opticore-catch-exception-error 1.0.10 → 1.0.12

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 CHANGED
@@ -208,26 +208,25 @@ var import_opticore_translator2 = require("opticore-translator");
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
210
  // src/core/errors/events/serverListen.event.error.ts
211
- var import_opticore_env_access2 = require("opticore-env-access");
211
+ var import_opticore_env_access = require("opticore-env-access");
212
212
 
213
213
  // src/core/config/loaders/translateLanguage.loader.ts
214
214
  var import_path = __toESM(require("path"), 1);
215
+ var import_module = require("module");
215
216
  var import_opticore_translator = require("opticore-translator");
216
- var import_opticore_env_access = require("opticore-env-access");
217
- var import_url = require("url");
218
- var translateCatchExceptionErrorLanguageLoader = () => {
219
- const __filename2 = (0, import_url.fileURLToPath)(importMetaUrl);
220
- const __dirname = import_path.default.dirname(__filename2);
221
- const translateMsgJsonFilePath = import_path.default.join(__dirname, "../../../../", "dist", "utils", "translations");
222
- import_opticore_translator.TranslationLoader.loadTranslations(translateMsgJsonFilePath, import_opticore_env_access.getEnvVariable.defaultLocal);
217
+ var translateCatchExceptionErrorLanguageLoader = (defaultLocalLang) => {
218
+ const require2 = (0, import_module.createRequire)(importMetaUrl);
219
+ const packagePath = import_path.default.dirname(require2.resolve("opticore-catch-exception-error"));
220
+ const translateMsgJsonFilePath = import_path.default.join(packagePath, "utils", "translations");
221
+ import_opticore_translator.TranslationLoader.loadTranslations(translateMsgJsonFilePath, defaultLocalLang);
223
222
  };
224
223
 
225
224
  // src/core/errors/events/serverListen.event.error.ts
226
225
  var ServerListenEventError = class {
227
226
  static logger = new import_opticore_logger.LoggerCore();
228
227
  static stackTrace;
229
- static __init() {
230
- translateCatchExceptionErrorLanguageLoader();
228
+ static __init(defaultLocalLang) {
229
+ translateCatchExceptionErrorLanguageLoader(defaultLocalLang);
231
230
  return this;
232
231
  }
233
232
  /**
@@ -242,7 +241,7 @@ var ServerListenEventError = class {
242
241
  this.logger.error(
243
242
  this.stackTrace.message,
244
243
  import_opticore_translator2.TranslationLoader.t("webServer", import_opticore_translator2.CLocal),
245
- import_opticore_translator2.TranslationLoader.t("badPort", import_opticore_translator2.CLocal, { badPort: import_opticore_env_access2.getEnvVariable.appPort }),
244
+ import_opticore_translator2.TranslationLoader.t("badPort", import_opticore_translator2.CLocal, { badPort: import_opticore_env_access.getEnvVariable.appPort }),
246
245
  this.stackTrace.stack,
247
246
  import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
248
247
  );
@@ -253,7 +252,7 @@ var ServerListenEventError = class {
253
252
  */
254
253
  static hostUndefined() {
255
254
  this.stackTrace = this.traceError(
256
- import_opticore_translator2.TranslationLoader.t("badHost", import_opticore_translator2.CLocal, { badHost: import_opticore_env_access2.getEnvVariable.appHost }),
255
+ import_opticore_translator2.TranslationLoader.t("badHost", import_opticore_translator2.CLocal, { badHost: import_opticore_env_access.getEnvVariable.appHost }),
257
256
  import_opticore_translator2.TranslationLoader.t("listening", import_opticore_translator2.CLocal),
258
257
  import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
259
258
  );
package/dist/index.d.cts CHANGED
@@ -130,7 +130,7 @@ declare class StackTraceURIError extends StackTraceError {
130
130
  declare class ServerListenEventError {
131
131
  private static logger;
132
132
  private static stackTrace;
133
- static __init(): typeof ServerListenEventError;
133
+ static __init(defaultLocalLang: string): typeof ServerListenEventError;
134
134
  /**
135
135
  *
136
136
  */
package/dist/index.d.ts CHANGED
@@ -130,7 +130,7 @@ declare class StackTraceURIError extends StackTraceError {
130
130
  declare class ServerListenEventError {
131
131
  private static logger;
132
132
  private static stackTrace;
133
- static __init(): typeof ServerListenEventError;
133
+ static __init(defaultLocalLang: string): typeof ServerListenEventError;
134
134
  /**
135
135
  *
136
136
  */
package/dist/index.js CHANGED
@@ -154,26 +154,25 @@ import { CLocal, TranslationLoader as TranslationLoader2 } from "opticore-transl
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
156
  // src/core/errors/events/serverListen.event.error.ts
157
- import { getEnvVariable as getEnvVariable2 } from "opticore-env-access";
157
+ import { getEnvVariable } from "opticore-env-access";
158
158
 
159
159
  // src/core/config/loaders/translateLanguage.loader.ts
160
160
  import path from "path";
161
+ import { createRequire } from "module";
161
162
  import { TranslationLoader } from "opticore-translator";
162
- import { getEnvVariable } from "opticore-env-access";
163
- import { fileURLToPath } from "url";
164
- var translateCatchExceptionErrorLanguageLoader = () => {
165
- const __filename2 = fileURLToPath(import.meta.url);
166
- const __dirname2 = path.dirname(__filename2);
167
- const translateMsgJsonFilePath = path.join(__dirname2, "../../../../", "dist", "utils", "translations");
168
- TranslationLoader.loadTranslations(translateMsgJsonFilePath, getEnvVariable.defaultLocal);
163
+ var translateCatchExceptionErrorLanguageLoader = (defaultLocalLang) => {
164
+ const require2 = createRequire(import.meta.url);
165
+ const packagePath = path.dirname(require2.resolve("opticore-catch-exception-error"));
166
+ const translateMsgJsonFilePath = path.join(packagePath, "utils", "translations");
167
+ TranslationLoader.loadTranslations(translateMsgJsonFilePath, defaultLocalLang);
169
168
  };
170
169
 
171
170
  // src/core/errors/events/serverListen.event.error.ts
172
171
  var ServerListenEventError = class {
173
172
  static logger = new LoggerCore();
174
173
  static stackTrace;
175
- static __init() {
176
- translateCatchExceptionErrorLanguageLoader();
174
+ static __init(defaultLocalLang) {
175
+ translateCatchExceptionErrorLanguageLoader(defaultLocalLang);
177
176
  return this;
178
177
  }
179
178
  /**
@@ -188,7 +187,7 @@ var ServerListenEventError = class {
188
187
  this.logger.error(
189
188
  this.stackTrace.message,
190
189
  TranslationLoader2.t("webServer", CLocal),
191
- TranslationLoader2.t("badPort", CLocal, { badPort: getEnvVariable2.appPort }),
190
+ TranslationLoader2.t("badPort", CLocal, { badPort: getEnvVariable.appPort }),
192
191
  this.stackTrace.stack,
193
192
  status11.BAD_REQUEST
194
193
  );
@@ -199,7 +198,7 @@ var ServerListenEventError = class {
199
198
  */
200
199
  static hostUndefined() {
201
200
  this.stackTrace = this.traceError(
202
- TranslationLoader2.t("badHost", CLocal, { badHost: getEnvVariable2.appHost }),
201
+ TranslationLoader2.t("badHost", CLocal, { badHost: getEnvVariable.appHost }),
203
202
  TranslationLoader2.t("listening", CLocal),
204
203
  status11.BAD_REQUEST
205
204
  );
@@ -1,82 +1,21 @@
1
1
  {
2
- "erBadDbError": "ER_BAD_DB_ERROR",
3
- "erAccessDeniedError": "ER_ACCESS_DENIED_ERROR",
4
- "erNotSupportedAuthMode": "ER_NOT_SUPPORTED_AUTH_MODE",
5
- "eAiAgain": "EAI_AGAIN",
6
- "dbConnection": "Database connection",
7
- "dbConnectionClosed": "MySQL connection is closed",
8
- "mysqlErrorCon": "MysqlError connection",
9
- "mySQLError": "MysqlError",
10
- "mySqlCloseConnection": "MySql close connection",
11
- "dbConnexionSuccess": "The database connection was successful 🚀",
12
- "mongoConnectionSuccess": "Connection to database is successfully.",
13
- "connSuccess": "success connection",
14
- "mongoDBConnectionChecker": "MongoDB Connection Checker",
15
- "mongoConnection": "connection",
16
- "mongoDBAuthentication": "authentication",
17
- "mongoDBConnection": "MongoDB connection",
18
- "mongoDBAuthenticationFailed": "failed",
19
- "mongoDBUnableParsingUrl": "unable to parse",
20
- "mongoDBConnectionUrl": "url",
21
- "mongoDBServerSelection": "MongoServer selection error",
22
- "mongoDBServer": "MongoServer",
23
- "mongoDBConnectionError": "connection error",
24
- "mongoDBError": "error",
25
- "mongoDBAuthenticationError": "Authentication failed, be sure the credentials is correct.",
26
- "postgresDBConnectionChecker": "PostgresDB Connection Checker",
27
- "postgresConnection": "connection",
28
- "postgresConnectionSuccess": "Connection to database is successfully.",
29
- "postgresSuccessConn": "Postgres client Connection",
30
- "postgresClosingConnSuccess": "Postgres client is close connection.",
31
- "postgresEndClientRejection": "Postgres client end rejected",
32
- "postgresClientError": "Postgres client error",
33
- "postgresEndRejection": "End rejected",
34
- "postgresConnError": "Postgres connection error",
35
- "postgresException": "Exception",
36
- "rsaKeyNotFound": "RSA key provided is not found.",
37
- "encryptionWithPrivateKeyFailed": "Encryption With PrivateKey",
38
- "encryptionFailed": "Encryption failed",
39
- "verifyExistingKey": "Verify Existing Key",
40
- "signatureRSAKeyFailed": "Signature verification failed.",
41
- "signatureRSAKeysError": "Signature RSA Keys Error",
42
- "errorDecryption": "Error decryption with private key",
43
- "errorNameNotVerifyingRSAKey": "Error Verify RSA Key",
44
- "decryptionWithPublicKeyFailed": "Decryption With PublicKey",
45
- "decryptionFailed": "Decryption failed",
46
- "verifyRSAKey": "Verify RSA Keys",
47
- "verifyRSAKeyFailed": "Verify RSA Keys Failed",
48
- "notVerifying": "Verification failed",
49
- "mongoServerError": "MongoServerSelectionError: getaddrinfo EAI_AGAIN ({dbHost} is not allow to database connection)",
50
- "dbUrlParsingError": "Unable to parse {dbHost}:{dbPort} with URL",
51
- "errorDBHost": "A database host {host} does not allow connection. Please either set the host like this: {localhost} in your .env file",
52
- "unknownDB": "Database {database} is unknown. Please try to use Database CLI to create your database, or do it manually in your Database Management System",
53
- "accessDeniedToDBCon": "Access denied for user {user}. Database credentials in .env file are User: {user} and Password: {password}. '{user}''{password}'@'localhost'. Try to set user and password in .env file",
54
- "badFormat": "Unsupported YAML line format",
55
- "parsingFailed": "YAML Parsing failed",
56
- "unsupportedFormat": "Unsupported YAML format",
57
- "readingError": "Error reading YAML file",
58
- "invalidRequest": "Invalid request",
59
- "moduleNotLoaded": "The following module paths are not loaded: {notLoadedPaths}",
60
- "serverRouteNotExist": "This route : http://{host}:{port} do not exist.",
61
- "webServer": "Web server",
2
+ "errorHostUrl": "The host and port are not define, please define them in .env",
62
3
  "listening": "listening",
4
+ "webServer": "Web server",
63
5
  "webHost": "host",
64
- "badHost": "bad host",
65
6
  "hostNotFound": "not found",
66
- "errorHostUrl": "The host and port are not define, please define them in .env",
67
- "badPort": "bad port",
7
+ "badHost": "bad host {badHost}",
8
+ "badPort": "bad port {badPort}",
68
9
  "errorPort": "The port is not correct. Please define a right port with number port.",
69
10
  "errorHost": "The host can't be empty or blank. Please define a string host in .env",
70
11
  "serverStart": "Server start",
71
- "serverStartError": "Server start error",
12
+ "serverStartError": "Server start with error {err}",
72
13
  "processExitCode": "Process will exit with code: {code}",
73
14
  "beforeExit": "BeforeExit",
74
- "processBeforeExit": "process before exit",
75
15
  "childProcessDiscon": "Child process disconnected",
76
16
  "processDiscon": "process disconnected",
77
- "disconnected": "Disconnected",
78
- "completed": "completed",
79
- "finishingProcessWell": "The process finished as expected and everything is ok",
17
+ "completed": "completed with code {code}",
18
+ "finishingProcessWell": "The process is finishing well with code {code}",
80
19
  "serverStopped": "[OK] The server shutting down",
81
20
  "somethingWentWrong": "Something went wrong",
82
21
  "genErrors": "General Errors",
@@ -88,8 +27,8 @@
88
27
  "cmdNotFoundInSystemPath": "The command was not found in the system's PATH or is misspelled",
89
28
  "argInvalid": "Invalid argument",
90
29
  "scriptEndedManuallyByCtrlC": "Indicates that the script was manually terminated by the user using the Control-C (SIGINT) signal",
91
- "processEndedBySIGKILL": "Indicates that the process was terminated by a SIGKILL signal, possibly due to an out-of-memory situation",
92
30
  "scriptEnded": "Script terminated",
31
+ "processEndedBySIGKILL": "Indicates that the process was terminated by a SIGKILL signal, possibly due to an out-of-memory situation",
93
32
  "accessProcessIllegally": "Indicates that the process accessed an illegal memory address (segfault)",
94
33
  "defaultSegment": "Segmentation fault",
95
34
  "processReceivedSigtermSignal": "Indicates that the process received a SIGTERM signal to terminate",
@@ -98,33 +37,22 @@
98
37
  "outRange": "out of range",
99
38
  "errorOccurring": "Error is occurring",
100
39
  "errors": "errors",
40
+ "warning": "Warning {warning}",
101
41
  "promiseRejectionHandled": "Promise rejection is handled at : {promise}",
102
- "rejectionPromise": "rejection promise",
42
+ "rejectionPromise": "rejection promise {promise}",
103
43
  "uncaughtExceptionHandled": "uncaught exception handled",
104
44
  "unhandledRejectionAtPromise": "Unhandled Rejection at: Promise {promise} -- reason {reason}",
105
- "unhandledRejection": "Unhandled rejection",
45
+ "unhandledRejection": "Unhandled rejection at: Promise {promise} -- reason {reason}",
106
46
  "processGotMsg": "process got message {message}",
107
- "msgException": "message exception",
47
+ "msgException": "message exception {}",
108
48
  "promiseReason": "{promise} -- {reason}",
109
49
  "multipleResolvesDetected": "Multiple resolves detected : {type}",
110
- "serverWebStopped": "The Web server has been stopped !",
111
50
  "okSuccess": "[ OK ] Success",
112
- "processPIDReceivedSignal": "Process ${process.pid} received a SIGTERM signal : {signal}",
113
- "serverClosed": "Server is closed",
51
+ "processPIDReceivedSignal": "Process ${process.pid} received a SIGTERM signal : {signal} {promise} -- {reason}",
114
52
  "allProcessStopped": "All processes are stopped",
115
- "serverDroppedCon": "The server dropped new connections",
116
- "serverMaxCon": "Server maxConnection",
117
- "internalServerError": "Internal Server Error",
118
- "resStatusNotFunc": "res.status is not a function",
119
- "respndNotFunc": "response not Function",
120
- "expressErrorHandlingMiddleware": "Express error-handling middleware",
121
- "expressError": "Express error",
122
- "serverRunning": "The server is running in",
123
- "okServerListening": "[OK] Web server listening",
124
- "webServerUseNodeVersion": "The Web server is using Node.js version",
125
- "startupTime": "Startup time:",
126
- "totalMemory": "Resident Set Size - total memory allocated for the process execution :",
127
- "memoryUsedDuringExecution": "Actual memory used during the execution :",
128
- "memoryUsedByUser": "Memory usage by user :",
129
- "memoryUsedBySystem": "Memory usage by system :"
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}"
130
58
  }
@@ -1,49 +1,58 @@
1
1
  {
2
- "erBadDbError": "ER_BAD_DB_ERROR",
3
- "erAccessDeniedError": "ER_ACCESS_DENIED_ERROR",
4
- "erNotSupportedAuthMode": "ER_NOT_SUPPORTED_AUTH_MODE",
5
- "eAiAgain": "EAI_AGAIN",
6
- "dbConnection": "DataBase connection",
7
- "dbConnectionClosed": "MySQL connection is closed",
8
- "mysqlErrorCon": "MysqlError connection",
9
- "mySQLError": "MysqlError",
10
- "mySqlCloseConnection": "MySql close connection",
11
- "mongoConnectionSuccess": "Connection to database is successfully.",
12
- "mongoDBConnectionChecker": "MongoDB Connection Checker",
13
- "mongoConnection": "connection",
14
- "mongoDBAuthentication": "authentication",
15
- "mongoDBConnection": "MongoDB connection",
16
- "mongoDBAuthenticationFailed": "failed",
17
- "mongoDBUnableParsingUrl": "unable to parse",
18
- "mongoDBConnectionUrl": "url",
19
- "mongoDBServerSelection": "MongoServer selection error",
20
- "mongoDBServer": "MongoServer",
21
- "mongoDBConnectionError": "connection error",
22
- "mongoDBError": "error",
23
- "mongoDBAuthenticationError": "Authentication failed, be sure the credentials is correct.",
24
- "postgresDBConnectionChecker": "PostgresDB Connection Checker",
25
- "postgresConnection": "connection",
26
- "postgresConnectionSuccess": "Connection to database is successfully.",
27
- "postgresSuccessConn": "Postgres client Connection",
28
- "postgresClosingConnSuccess": "Postgres client is close connection.",
29
- "postgresEndClientRejection": "Postgres client end rejected",
30
- "postgresClientError": "Postgres client error",
31
- "postgresEndRejection": "End rejected",
32
- "postgresConnError": "Postgres connection error",
33
- "postgresException": "Exception",
34
- "rsaKeyNotFound": "RSA key provided is not found.",
35
- "encryptionWithPrivateKeyFailed": "Encryption With PrivateKey",
36
- "encryptionFailed": "Encryption failed",
37
- "verifyExistingKey": "Verify Existing Key",
38
- "signatureRSAKeyFailed": "Signature verification failed.",
39
- "signatureRSAKeysError": "Signature RSA Keys Error",
40
- "errorDecryption": "Error decryption with private key",
41
- "errorNameNotVerifyingRSAKey": "Error Verify RSA Key",
42
- "decryptionWithPublicKeyFailed": "Decryption With PublicKey",
43
- "decryptionFailed": "Decryption failed",
44
- "verifyRSAKey": "Verify RSA Keys",
45
- "verifyRSAKeyFailed": "Verify RSA Keys Failed",
46
- "notVerifying": "Verification failed",
47
- "mongoServerError": "MongoServerSelectionError: getaddrinfo EAI_AGAIN ({dbHost} is not allow to database connection)",
48
- "dbUrlParsingError": "Unable to parse ${dbHost}:${dbPort} with URL"
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
+ "badHost": "bad host",
7
+ "hostNotFound": "not found",
8
+ "badPort": "bad port",
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 error",
13
+ "processExitCode": "Process will exit with code: {code}",
14
+ "beforeExit": "BeforeExit",
15
+ "childProcessDiscon": "Child process disconnected",
16
+ "processDiscon": "process disconnected",
17
+ "completed": "completed",
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",
41
+ "promiseRejectionHandled": "Promise rejection is handled at : {promise}",
42
+ "rejectionPromise": "rejection promise",
43
+ "uncaughtExceptionHandled": "uncaught exception handled",
44
+ "unhandledRejectionAtPromise": "Unhandled Rejection at: Promise {promise} -- reason {reason}",
45
+ "unhandledRejection": "Unhandled rejection",
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}",
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}"
49
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opticore-catch-exception-error",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "opticore catch exception error",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",