opticore-catch-exception-error 1.0.16 → 1.0.18

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
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  JavaScriptErrors: () => JavaScriptErrors,
39
39
  OpenSSLErrors: () => OpenSSLErrors,
40
40
  ServerListenEventError: () => ServerListenEventError,
41
+ StackTraceError: () => StackTraceError,
41
42
  SystemErrors: () => SystemErrors
42
43
  });
43
44
  module.exports = __toCommonJS(index_exports);
@@ -503,7 +504,7 @@ var ServerListenEventError = class {
503
504
  this.stackTrace.message,
504
505
  "UncaughtException",
505
506
  this.stackTrace.name,
506
- this.stackTrace.stack,
507
+ error.stack,
507
508
  import_opticore_http_response.HttpStatusCode.SERVICE_UNAVAILABLE
508
509
  );
509
510
  }
@@ -666,7 +667,7 @@ var ServerListenEventError = class {
666
667
  this.stackTrace.message,
667
668
  import_opticore_translator2.TranslationLoader.t("expressErrorHandlingMiddleware", this.localeLanguage, { err }),
668
669
  this.stackTrace.name,
669
- this.stackTrace.stack,
670
+ err.stack,
670
671
  import_opticore_http_response.HttpStatusCode.SERVICE_UNAVAILABLE
671
672
  );
672
673
  } else {
@@ -695,7 +696,7 @@ var JavaScriptErrors = class {
695
696
  import_opticore_translator3.TranslationLoader.t(this.stackTrace.message, this.localLanguage),
696
697
  "Error",
697
698
  this.stackTrace.name,
698
- this.stackTrace.stack,
699
+ error.stack,
699
700
  import_opticore_http_response2.HttpStatusCode.INTERNAL_SERVER_ERROR
700
701
  );
701
702
  }
@@ -781,7 +782,7 @@ var SystemErrors = class {
781
782
  import_opticore_translator4.TranslationLoader.t(this.stackTrace.message, this.localLanguage),
782
783
  "EACCES",
783
784
  this.stackTrace.name,
784
- this.stackTrace.stack,
785
+ error.stack,
785
786
  import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
786
787
  );
787
788
  }
@@ -927,7 +928,7 @@ var OpenSSLErrors = class {
927
928
  import_opticore_translator5.TranslationLoader.t(this.stackTrace.message, this.localLanguage),
928
929
  "ERR_OSSL_EVP_UNSUPPORTED",
929
930
  this.stackTrace.name,
930
- this.stackTrace.stack,
931
+ error.stack,
931
932
  import_opticore_http_response4.HttpStatusCode.INTERNAL_SERVER_ERROR
932
933
  );
933
934
  }
@@ -973,7 +974,7 @@ var InternalErrors = class {
973
974
  import_opticore_translator6.TranslationLoader.t(this.stackTrace.message, this.localLanguage),
974
975
  "ERR_INVALID_ARG_TYPE",
975
976
  this.stackTrace.name,
976
- this.stackTrace.stack,
977
+ error.stack,
977
978
  import_opticore_http_response5.HttpStatusCode.INTERNAL_SERVER_ERROR
978
979
  );
979
980
  }
@@ -1049,7 +1050,7 @@ var AssertionErrors = class {
1049
1050
  import_opticore_translator7.TranslationLoader.t(this.stackTrace.message, this.localLanguage),
1050
1051
  "Error",
1051
1052
  this.stackTrace.name,
1052
- this.stackTrace.stack,
1053
+ error.stack,
1053
1054
  import_opticore_http_response6.HttpStatusCode.INTERNAL_SERVER_ERROR
1054
1055
  );
1055
1056
  }
@@ -1127,5 +1128,6 @@ var AssertionErrors = class {
1127
1128
  JavaScriptErrors,
1128
1129
  OpenSSLErrors,
1129
1130
  ServerListenEventError,
1131
+ StackTraceError,
1130
1132
  SystemErrors
1131
1133
  });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import EventEmitter from 'node:events';
2
2
  import { Request, Response, NextFunction } from 'opticore-express';
3
+ import { HttpStatusCode } from 'opticore-http-response';
3
4
 
4
5
  declare const CErrorName: {
5
6
  assertionError: string;
@@ -252,4 +253,21 @@ declare class AssertionErrors {
252
253
  private traceError;
253
254
  }
254
255
 
255
- export { AssertionErrors, CErrorName, CEvent, CEventNameError, InternalErrors, JavaScriptErrors, OpenSSLErrors, ServerListenEventError, SystemErrors };
256
+ /**
257
+ * Handling and catch a Node.js error.
258
+ */
259
+ declare class StackTraceError extends Error {
260
+ readonly name: string;
261
+ readonly httpCode: HttpStatusCode | any;
262
+ readonly isOperational: boolean;
263
+ /**
264
+ *
265
+ * @param props
266
+ * @param name
267
+ * @param httpCode
268
+ * @param isOperational
269
+ */
270
+ constructor(props: string | undefined, name: string, httpCode: HttpStatusCode | any, isOperational: boolean);
271
+ }
272
+
273
+ export { AssertionErrors, CErrorName, CEvent, CEventNameError, InternalErrors, JavaScriptErrors, OpenSSLErrors, ServerListenEventError, StackTraceError, SystemErrors };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import EventEmitter from 'node:events';
2
2
  import { Request, Response, NextFunction } from 'opticore-express';
3
+ import { HttpStatusCode } from 'opticore-http-response';
3
4
 
4
5
  declare const CErrorName: {
5
6
  assertionError: string;
@@ -252,4 +253,21 @@ declare class AssertionErrors {
252
253
  private traceError;
253
254
  }
254
255
 
255
- export { AssertionErrors, CErrorName, CEvent, CEventNameError, InternalErrors, JavaScriptErrors, OpenSSLErrors, ServerListenEventError, SystemErrors };
256
+ /**
257
+ * Handling and catch a Node.js error.
258
+ */
259
+ declare class StackTraceError extends Error {
260
+ readonly name: string;
261
+ readonly httpCode: HttpStatusCode | any;
262
+ readonly isOperational: boolean;
263
+ /**
264
+ *
265
+ * @param props
266
+ * @param name
267
+ * @param httpCode
268
+ * @param isOperational
269
+ */
270
+ constructor(props: string | undefined, name: string, httpCode: HttpStatusCode | any, isOperational: boolean);
271
+ }
272
+
273
+ export { AssertionErrors, CErrorName, CEvent, CEventNameError, InternalErrors, JavaScriptErrors, OpenSSLErrors, ServerListenEventError, StackTraceError, SystemErrors };
package/dist/index.js CHANGED
@@ -455,7 +455,7 @@ var ServerListenEventError = class {
455
455
  this.stackTrace.message,
456
456
  "UncaughtException",
457
457
  this.stackTrace.name,
458
- this.stackTrace.stack,
458
+ error.stack,
459
459
  status.SERVICE_UNAVAILABLE
460
460
  );
461
461
  }
@@ -618,7 +618,7 @@ var ServerListenEventError = class {
618
618
  this.stackTrace.message,
619
619
  TranslationLoader2.t("expressErrorHandlingMiddleware", this.localeLanguage, { err }),
620
620
  this.stackTrace.name,
621
- this.stackTrace.stack,
621
+ err.stack,
622
622
  status.SERVICE_UNAVAILABLE
623
623
  );
624
624
  } else {
@@ -647,7 +647,7 @@ var JavaScriptErrors = class {
647
647
  TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
648
648
  "Error",
649
649
  this.stackTrace.name,
650
- this.stackTrace.stack,
650
+ error.stack,
651
651
  status2.INTERNAL_SERVER_ERROR
652
652
  );
653
653
  }
@@ -733,7 +733,7 @@ var SystemErrors = class {
733
733
  TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
734
734
  "EACCES",
735
735
  this.stackTrace.name,
736
- this.stackTrace.stack,
736
+ error.stack,
737
737
  status3.INTERNAL_SERVER_ERROR
738
738
  );
739
739
  }
@@ -879,7 +879,7 @@ var OpenSSLErrors = class {
879
879
  TranslationLoader5.t(this.stackTrace.message, this.localLanguage),
880
880
  "ERR_OSSL_EVP_UNSUPPORTED",
881
881
  this.stackTrace.name,
882
- this.stackTrace.stack,
882
+ error.stack,
883
883
  status4.INTERNAL_SERVER_ERROR
884
884
  );
885
885
  }
@@ -925,7 +925,7 @@ var InternalErrors = class {
925
925
  TranslationLoader6.t(this.stackTrace.message, this.localLanguage),
926
926
  "ERR_INVALID_ARG_TYPE",
927
927
  this.stackTrace.name,
928
- this.stackTrace.stack,
928
+ error.stack,
929
929
  status5.INTERNAL_SERVER_ERROR
930
930
  );
931
931
  }
@@ -1001,7 +1001,7 @@ var AssertionErrors = class {
1001
1001
  TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
1002
1002
  "Error",
1003
1003
  this.stackTrace.name,
1004
- this.stackTrace.stack,
1004
+ error.stack,
1005
1005
  status6.INTERNAL_SERVER_ERROR
1006
1006
  );
1007
1007
  }
@@ -1078,5 +1078,6 @@ export {
1078
1078
  JavaScriptErrors,
1079
1079
  OpenSSLErrors,
1080
1080
  ServerListenEventError,
1081
+ StackTraceError,
1081
1082
  SystemErrors
1082
1083
  };
@@ -1,58 +1,58 @@
1
1
  {
2
- "errorHostUrl": "The host and port are not define, please define them in .env",
3
- "listening": "listening",
4
- "webServer": "Web server",
5
- "webHost": "host",
6
- "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}",
2
+ "errorHostUrl": "L'hôte et le port ne sont pas définis, veuillez les définir dans .env",
3
+ "listening": "écoute",
4
+ "webServer": "Serveur Web",
5
+ "webHost": "hôte",
6
+ "badHost": "mauvais hôte",
7
+ "hostNotFound": "introuvable",
8
+ "badPort": "mauvais port",
9
+ "errorPort": "Le port n'est pas correcte. Veuillez définir un port correct avec le numéro de port.",
10
+ "errorHost": "L'hôte ne peut être vide. Veuillez définir une chaîne d'hôte dans .env.",
11
+ "serverStart": "Démarrage du serveur",
12
+ "serverStartError": "Erreur de démarrage du serveur",
13
+ "processExitCode": "Le processus se terminera avec le code : {code}",
14
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",
15
+ "childProcessDiscon": "Processus enfant déconnecté",
16
+ "processDiscon": "processus déconnecté",
17
+ "completed": "complété",
18
+ "finishingProcessWell": "Le processus se termine bien avec le code {code}",
19
+ "serverStopped": "[OK] Le serveur s'arrête",
20
+ "somethingWentWrong": "Quelque chose s'est mal passé",
21
+ "genErrors": "Erreur Generale",
22
+ "exited": "Sortie",
23
+ "incorrectCmd": "Utilisation incorrecte des commandes shell",
24
+ "misuseShell": "Mauvaise utilisation des fonctions intégrées du shell",
25
+ "cmdNotExecutable": "La commande est trouvée mais n'est pas exécutable (par exemple, tentative d'exécution d'un répertoire)",
26
+ "cmdNotFound": "Commande non trouvée",
27
+ "cmdNotFoundInSystemPath": "La commande n'a pas été trouvée dans le PATH du système ou est mal orthographiée",
28
+ "argInvalid": "Argument invalide",
29
+ "scriptEndedManuallyByCtrlC": "Indique que le script a été arrêté manuellement par l'utilisateur à l'aide du signal Control-C (SIGINT)",
30
+ "scriptEnded": "Script interrompu",
31
+ "processEndedBySIGKILL": "Indique que le processus a été interrompu par un signal SIGKILL, probablement en raison d'une situation de manque de mémoire",
32
+ "accessProcessIllegally": "Indique que le processus a accédé à une adresse mémoire illégale (segfault)",
33
+ "defaultSegment": "Erreur de segmentation",
34
+ "processReceivedSigtermSignal": "Indique que le processus a reçu un signal SIGTERM pour s'interrompre",
35
+ "processReceived": "le processus a reçu un SIGTERM",
36
+ "exitCode": "Code de sortie en dehors de la plage autorisée (0-255 pour les systèmes de type Unix)",
37
+ "outRange": "hors de portée",
38
+ "errorOccurring": "Une erreur se produit",
39
+ "errors": "erreurs",
40
+ "warning": "Avertissement",
41
+ "promiseRejectionHandled": "Le rejet de la promesse est traité à : {promise}",
42
+ "rejectionPromise": "promesse de rejet",
43
+ "uncaughtExceptionHandled": "exception non interceptée gérée",
44
+ "unhandledRejectionAtPromise": "Rejet non géré à : Promesse {promise} -- raison {reason}",
45
+ "unhandledRejection": "Rejet non traité",
46
+ "processGotMsg": "le processus a reçu le message {message}",
47
+ "msgException": "message d'exception",
48
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
+ "multipleResolvesDetected": "Résolutions multiples détectées : {type}",
50
+ "okSuccess": "[ OK ] Succès",
51
+ "processPIDReceivedSignal": "Le processus {process.pid} a reçu un signal SIGTERM",
52
+ "allProcessStopped": "Tous les processus sont interrompus",
53
+ "internalServerError": "Erreur interne du serveur : {err}",
54
+ "resStatusNotFunc": "res.status n'est pas une fonction {err}",
55
+ "respndNotFunc": "réponse non Fonction {err}",
56
+ "expressErrorHandlingMiddleware": "Middleware express de gestion des erreurs {err}",
57
+ "expressError": "Erreur express {err}"
58
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opticore-catch-exception-error",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "opticore catch exception error",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",