opticore-catch-exception-error 1.0.12 → 1.0.14
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 +418 -127
- package/dist/index.d.cts +245 -32
- package/dist/index.d.ts +245 -32
- package/dist/index.js +392 -127
- package/dist/utils/translations/message.translation.en.json +1 -1
- package/example/index.ts +2 -2
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -35,8 +35,32 @@ __export(index_exports, {
|
|
|
35
35
|
CEventNameError: () => CEventNameError,
|
|
36
36
|
ServerListenEventError: () => ServerListenEventError,
|
|
37
37
|
StackTraceAssertionError: () => StackTraceAssertionError,
|
|
38
|
+
StackTraceBeforeExit: () => StackTraceBeforeExit,
|
|
39
|
+
StackTraceEACCES: () => StackTraceEACCES,
|
|
40
|
+
StackTraceEADDRINUSE: () => StackTraceEADDRINUSE,
|
|
41
|
+
StackTraceECONNREFUSED: () => StackTraceECONNREFUSED,
|
|
42
|
+
StackTraceECONNRESET: () => StackTraceECONNRESET,
|
|
43
|
+
StackTraceEEXIST: () => StackTraceEEXIST,
|
|
44
|
+
StackTraceEISDIR: () => StackTraceEISDIR,
|
|
45
|
+
StackTraceEMFILE: () => StackTraceEMFILE,
|
|
46
|
+
StackTraceENOENT: () => StackTraceENOENT,
|
|
47
|
+
StackTraceENOTDIR: () => StackTraceENOTDIR,
|
|
48
|
+
StackTraceENOTEMPTY: () => StackTraceENOTEMPTY,
|
|
49
|
+
StackTraceEPERM: () => StackTraceEPERM,
|
|
50
|
+
StackTraceEPIPE: () => StackTraceEPIPE,
|
|
51
|
+
StackTraceERR_HTTP_HEADERS_SENT: () => StackTraceERR_HTTP_HEADERS_SENT,
|
|
52
|
+
StackTraceERR_INVALID_ARG_TYPE: () => StackTraceERR_INVALID_ARG_TYPE,
|
|
53
|
+
StackTraceERR_INVALID_CALLBACK: () => StackTraceERR_INVALID_CALLBACK,
|
|
54
|
+
StackTraceERR_OSSL_BAD_DECRYPT: () => StackTraceERR_OSSL_BAD_DECRYPT,
|
|
55
|
+
StackTraceERR_OSSL_EVP_UNSUPPORTED: () => StackTraceERR_OSSL_EVP_UNSUPPORTED,
|
|
56
|
+
StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH: () => StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH,
|
|
57
|
+
StackTraceERR_STREAM_DESTROYED: () => StackTraceERR_STREAM_DESTROYED,
|
|
58
|
+
StackTraceERR_TLS_CERT_ALTNAME_INVALID: () => StackTraceERR_TLS_CERT_ALTNAME_INVALID,
|
|
59
|
+
StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME: () => StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME,
|
|
60
|
+
StackTraceETIMEDOUT: () => StackTraceETIMEDOUT,
|
|
38
61
|
StackTraceError: () => StackTraceError,
|
|
39
62
|
StackTraceEvalError: () => StackTraceEvalError,
|
|
63
|
+
StackTraceExit: () => StackTraceExit,
|
|
40
64
|
StackTraceGeneralError: () => StackTraceGeneralError,
|
|
41
65
|
StackTraceOpenSSLError: () => StackTraceOpenSSLError,
|
|
42
66
|
StackTraceRangeError: () => StackTraceRangeError,
|
|
@@ -44,7 +68,9 @@ __export(index_exports, {
|
|
|
44
68
|
StackTraceSyntaxError: () => StackTraceSyntaxError,
|
|
45
69
|
StackTraceSystemError: () => StackTraceSystemError,
|
|
46
70
|
StackTraceTypeError: () => StackTraceTypeError,
|
|
47
|
-
StackTraceURIError: () => StackTraceURIError
|
|
71
|
+
StackTraceURIError: () => StackTraceURIError,
|
|
72
|
+
StackTraceUncaughtException: () => StackTraceUncaughtException,
|
|
73
|
+
StackTraceUnhandledRejection: () => StackTraceUnhandledRejection
|
|
48
74
|
});
|
|
49
75
|
module.exports = __toCommonJS(index_exports);
|
|
50
76
|
|
|
@@ -54,16 +80,43 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
54
80
|
|
|
55
81
|
// src/domains/constants/errorName.constant.ts
|
|
56
82
|
var CErrorName = {
|
|
83
|
+
assertionError: "AssertionError",
|
|
84
|
+
beforeExit: "beforeExit",
|
|
85
|
+
eacces: "EACCES",
|
|
86
|
+
eaddrinuse: "EADDRINUSE",
|
|
87
|
+
econnrefused: "ECONNREFUSED",
|
|
88
|
+
econnreset: "ECONNRESET",
|
|
89
|
+
eexist: "EEXIST",
|
|
90
|
+
error: "Error",
|
|
91
|
+
eisdir: "EISDIR",
|
|
92
|
+
emfile: "EMFILE",
|
|
93
|
+
enoent: "ENOENT",
|
|
94
|
+
enotdir: "ENOTDIR",
|
|
95
|
+
enotEmpty: "ENOTEMPTY",
|
|
96
|
+
eperm: "EPERM",
|
|
97
|
+
epipe: "EPIPE",
|
|
98
|
+
etimedout: "ETIMEDOUT",
|
|
57
99
|
evalError: "EvalError",
|
|
58
|
-
|
|
100
|
+
errOsslEvpUnsupported: "ERR_OSSL_EVP_UNSUPPORTED",
|
|
101
|
+
errOsslBadDecrypt: "ERR_OSSL_BAD_DECRYPT",
|
|
102
|
+
errOsslWrongFinalBlockLength: "ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH",
|
|
103
|
+
errInvalidArgType: "ERR_INVALID_ARG_TYPE",
|
|
104
|
+
errInvalidCallback: "ERR_INVALID_CALLBACK",
|
|
105
|
+
errHttpHeadersSent: "ERR_HTTP_HEADERS_SENT",
|
|
106
|
+
errStreamDestroyed: "ERR_STREAM_DESTROYED",
|
|
107
|
+
errTlsCertAltnameInvalid: "ERR_TLS_CERT_ALTNAME_INVALID",
|
|
108
|
+
errUnsupportedEsmUrlScheme: "ERR_UNSUPPORTED_ESM_URL_SCHEME",
|
|
109
|
+
exit: "exit",
|
|
110
|
+
generalError: "GeneralError",
|
|
111
|
+
openSSLError: "OpenSSLError",
|
|
59
112
|
rangeError: "RangeError",
|
|
60
113
|
referenceError: "ReferenceError",
|
|
114
|
+
systemError: "SystemError",
|
|
115
|
+
syntaxError: "SyntaxError",
|
|
61
116
|
typeError: "TypeError",
|
|
62
117
|
uriError: "URIError",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
openSSLError: "OpenSSLError",
|
|
66
|
-
generalError: "GeneralError"
|
|
118
|
+
uncaughtException: "uncaughtException",
|
|
119
|
+
unhandledRejection: "unhandledRejection"
|
|
67
120
|
};
|
|
68
121
|
|
|
69
122
|
// src/domains/constants/event.constant.ts
|
|
@@ -119,7 +172,7 @@ var StackTraceError = class extends Error {
|
|
|
119
172
|
var import_opticore_http_response = require("opticore-http-response");
|
|
120
173
|
var StackTraceAssertionError = class extends StackTraceError {
|
|
121
174
|
constructor(message) {
|
|
122
|
-
super(message, CErrorName.
|
|
175
|
+
super(message, CErrorName.assertionError, import_opticore_http_response.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
123
176
|
}
|
|
124
177
|
};
|
|
125
178
|
|
|
@@ -135,7 +188,7 @@ var StackTraceEvalError = class extends StackTraceError {
|
|
|
135
188
|
var import_opticore_http_response3 = require("opticore-http-response");
|
|
136
189
|
var StackTraceGeneralError = class extends StackTraceError {
|
|
137
190
|
constructor(message) {
|
|
138
|
-
super(message, CErrorName.
|
|
191
|
+
super(message, CErrorName.generalError, import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR, false);
|
|
139
192
|
}
|
|
140
193
|
};
|
|
141
194
|
|
|
@@ -143,7 +196,7 @@ var StackTraceGeneralError = class extends StackTraceError {
|
|
|
143
196
|
var import_opticore_http_response4 = require("opticore-http-response");
|
|
144
197
|
var StackTraceOpenSSLError = class extends StackTraceError {
|
|
145
198
|
constructor(message) {
|
|
146
|
-
super(message, CErrorName.
|
|
199
|
+
super(message, CErrorName.openSSLError, import_opticore_http_response4.HttpStatusCode.INTERNAL_SERVER_ERROR, false);
|
|
147
200
|
}
|
|
148
201
|
};
|
|
149
202
|
|
|
@@ -151,7 +204,7 @@ var StackTraceOpenSSLError = class extends StackTraceError {
|
|
|
151
204
|
var import_opticore_http_response5 = require("opticore-http-response");
|
|
152
205
|
var StackTraceRangeError = class extends StackTraceError {
|
|
153
206
|
constructor(message) {
|
|
154
|
-
super(message, CErrorName.
|
|
207
|
+
super(message, CErrorName.rangeError, import_opticore_http_response5.HttpStatusCode.BAD_REQUEST, true);
|
|
155
208
|
}
|
|
156
209
|
};
|
|
157
210
|
|
|
@@ -159,7 +212,7 @@ var StackTraceRangeError = class extends StackTraceError {
|
|
|
159
212
|
var import_opticore_http_response6 = require("opticore-http-response");
|
|
160
213
|
var StackTraceReferenceError = class extends StackTraceError {
|
|
161
214
|
constructor(message) {
|
|
162
|
-
super(message, CErrorName.
|
|
215
|
+
super(message, CErrorName.referenceError, import_opticore_http_response6.HttpStatusCode.BAD_REQUEST, true);
|
|
163
216
|
}
|
|
164
217
|
};
|
|
165
218
|
|
|
@@ -167,7 +220,7 @@ var StackTraceReferenceError = class extends StackTraceError {
|
|
|
167
220
|
var import_opticore_http_response7 = require("opticore-http-response");
|
|
168
221
|
var StackTraceSyntaxError = class extends StackTraceError {
|
|
169
222
|
constructor(message) {
|
|
170
|
-
super(message, CErrorName.
|
|
223
|
+
super(message, CErrorName.syntaxError, import_opticore_http_response7.HttpStatusCode.BAD_REQUEST, true);
|
|
171
224
|
}
|
|
172
225
|
};
|
|
173
226
|
|
|
@@ -184,7 +237,7 @@ var StackTraceSystemError = class extends StackTraceError {
|
|
|
184
237
|
var import_opticore_http_response9 = require("opticore-http-response");
|
|
185
238
|
var StackTraceTypeError = class extends StackTraceError {
|
|
186
239
|
constructor(message) {
|
|
187
|
-
super(message, CErrorName.
|
|
240
|
+
super(message, CErrorName.typeError, import_opticore_http_response9.HttpStatusCode.BAD_REQUEST, true);
|
|
188
241
|
}
|
|
189
242
|
};
|
|
190
243
|
|
|
@@ -192,7 +245,7 @@ var StackTraceTypeError = class extends StackTraceError {
|
|
|
192
245
|
var import_opticore_http_response10 = require("opticore-http-response");
|
|
193
246
|
var StackTraceURIError = class extends StackTraceError {
|
|
194
247
|
constructor(message) {
|
|
195
|
-
super(message, CErrorName.
|
|
248
|
+
super(message, CErrorName.uriError, import_opticore_http_response10.HttpStatusCode.BAD_REQUEST, true);
|
|
196
249
|
}
|
|
197
250
|
};
|
|
198
251
|
|
|
@@ -207,9 +260,6 @@ var import_opticore_translator2 = require("opticore-translator");
|
|
|
207
260
|
// src/utils/dateTimeFormatted.utils.ts
|
|
208
261
|
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
262
|
|
|
210
|
-
// src/core/errors/events/serverListen.event.error.ts
|
|
211
|
-
var import_opticore_env_access = require("opticore-env-access");
|
|
212
|
-
|
|
213
263
|
// src/core/config/loaders/translateLanguage.loader.ts
|
|
214
264
|
var import_path = __toESM(require("path"), 1);
|
|
215
265
|
var import_module = require("module");
|
|
@@ -223,43 +273,46 @@ var translateCatchExceptionErrorLanguageLoader = (defaultLocalLang) => {
|
|
|
223
273
|
|
|
224
274
|
// src/core/errors/events/serverListen.event.error.ts
|
|
225
275
|
var ServerListenEventError = class {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
276
|
+
logger = new import_opticore_logger.LoggerCore();
|
|
277
|
+
stackTrace;
|
|
278
|
+
localeLanguage;
|
|
279
|
+
constructor(defaultLocalLang) {
|
|
280
|
+
this.localeLanguage = defaultLocalLang;
|
|
229
281
|
translateCatchExceptionErrorLanguageLoader(defaultLocalLang);
|
|
230
|
-
return this;
|
|
231
282
|
}
|
|
232
283
|
/**
|
|
284
|
+
* @param appPort
|
|
233
285
|
*
|
|
234
286
|
*/
|
|
235
|
-
|
|
287
|
+
hostPortUndefined(appPort) {
|
|
236
288
|
this.stackTrace = this.traceError(
|
|
237
|
-
import_opticore_translator2.TranslationLoader.t("errorHostUrl",
|
|
238
|
-
import_opticore_translator2.TranslationLoader.t("listening",
|
|
289
|
+
import_opticore_translator2.TranslationLoader.t("errorHostUrl", this.localeLanguage),
|
|
290
|
+
import_opticore_translator2.TranslationLoader.t("listening", this.localeLanguage),
|
|
239
291
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
240
292
|
);
|
|
241
293
|
this.logger.error(
|
|
242
294
|
this.stackTrace.message,
|
|
243
|
-
import_opticore_translator2.TranslationLoader.t("webServer",
|
|
244
|
-
import_opticore_translator2.TranslationLoader.t("badPort",
|
|
295
|
+
import_opticore_translator2.TranslationLoader.t("webServer", this.localeLanguage),
|
|
296
|
+
import_opticore_translator2.TranslationLoader.t("badPort", this.localeLanguage, { badPort: appPort }),
|
|
245
297
|
this.stackTrace.stack,
|
|
246
298
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
247
299
|
);
|
|
248
300
|
import_process.default.exit();
|
|
249
301
|
}
|
|
250
302
|
/**
|
|
303
|
+
* @param appHost
|
|
251
304
|
*
|
|
252
305
|
*/
|
|
253
|
-
|
|
306
|
+
hostUndefined(appHost) {
|
|
254
307
|
this.stackTrace = this.traceError(
|
|
255
|
-
import_opticore_translator2.TranslationLoader.t("badHost",
|
|
256
|
-
import_opticore_translator2.TranslationLoader.t("listening",
|
|
308
|
+
import_opticore_translator2.TranslationLoader.t("badHost", this.localeLanguage, { badHost: appHost }),
|
|
309
|
+
import_opticore_translator2.TranslationLoader.t("listening", this.localeLanguage),
|
|
257
310
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
258
311
|
);
|
|
259
312
|
this.logger.error(
|
|
260
313
|
this.stackTrace.message,
|
|
261
|
-
import_opticore_translator2.TranslationLoader.t("webServer",
|
|
262
|
-
import_opticore_translator2.TranslationLoader.t("badHost",
|
|
314
|
+
import_opticore_translator2.TranslationLoader.t("webServer", this.localeLanguage),
|
|
315
|
+
import_opticore_translator2.TranslationLoader.t("badHost", this.localeLanguage),
|
|
263
316
|
this.stackTrace.stack,
|
|
264
317
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
265
318
|
);
|
|
@@ -268,30 +321,30 @@ var ServerListenEventError = class {
|
|
|
268
321
|
/**
|
|
269
322
|
*
|
|
270
323
|
*/
|
|
271
|
-
|
|
324
|
+
portUndefined() {
|
|
272
325
|
this.stackTrace = this.traceError(
|
|
273
|
-
import_opticore_translator2.TranslationLoader.t("badPort",
|
|
274
|
-
import_opticore_translator2.TranslationLoader.t("listening",
|
|
326
|
+
import_opticore_translator2.TranslationLoader.t("badPort", this.localeLanguage),
|
|
327
|
+
import_opticore_translator2.TranslationLoader.t("listening", this.localeLanguage),
|
|
275
328
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
276
329
|
);
|
|
277
330
|
this.logger.error(
|
|
278
331
|
this.stackTrace.message,
|
|
279
|
-
import_opticore_translator2.TranslationLoader.t("webServer",
|
|
280
|
-
import_opticore_translator2.TranslationLoader.t("badHost",
|
|
332
|
+
import_opticore_translator2.TranslationLoader.t("webServer", this.localeLanguage),
|
|
333
|
+
import_opticore_translator2.TranslationLoader.t("badHost", this.localeLanguage),
|
|
281
334
|
this.stackTrace.stack,
|
|
282
335
|
import_opticore_http_response11.HttpStatusCode.BAD_REQUEST
|
|
283
336
|
);
|
|
284
337
|
import_process.default.exit();
|
|
285
338
|
}
|
|
286
339
|
/**
|
|
287
|
-
*
|
|
288
340
|
* @param err
|
|
341
|
+
*
|
|
289
342
|
*/
|
|
290
|
-
|
|
343
|
+
onEventError(err) {
|
|
291
344
|
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",
|
|
345
|
+
import_opticore_translator2.TranslationLoader.t(err.message, this.localeLanguage),
|
|
346
|
+
import_opticore_translator2.TranslationLoader.t("serverStart", this.localeLanguage),
|
|
347
|
+
import_opticore_translator2.TranslationLoader.t("serverStartError", this.localeLanguage, { err }),
|
|
295
348
|
err.stack,
|
|
296
349
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
297
350
|
);
|
|
@@ -300,7 +353,7 @@ var ServerListenEventError = class {
|
|
|
300
353
|
*
|
|
301
354
|
* @param error
|
|
302
355
|
*/
|
|
303
|
-
|
|
356
|
+
listenerError(error) {
|
|
304
357
|
this.stackTrace = this.traceError(
|
|
305
358
|
error.message,
|
|
306
359
|
error.name,
|
|
@@ -315,19 +368,19 @@ var ServerListenEventError = class {
|
|
|
315
368
|
);
|
|
316
369
|
}
|
|
317
370
|
/**
|
|
318
|
-
*
|
|
319
371
|
* @param code
|
|
372
|
+
*
|
|
320
373
|
*/
|
|
321
|
-
|
|
374
|
+
processBeforeExit(code) {
|
|
322
375
|
this.stackTrace = this.traceError(
|
|
323
|
-
import_opticore_translator2.TranslationLoader.t("processExitCode",
|
|
324
|
-
import_opticore_translator2.TranslationLoader.t("beforeExit",
|
|
376
|
+
import_opticore_translator2.TranslationLoader.t("processExitCode", this.localeLanguage, { processExitCode: code }),
|
|
377
|
+
import_opticore_translator2.TranslationLoader.t("beforeExit", this.localeLanguage),
|
|
325
378
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
326
379
|
);
|
|
327
380
|
this.logger.error(
|
|
328
381
|
this.stackTrace.message,
|
|
329
|
-
import_opticore_translator2.TranslationLoader.t("beforeExit",
|
|
330
|
-
import_opticore_translator2.TranslationLoader.t("processBeforeExit",
|
|
382
|
+
import_opticore_translator2.TranslationLoader.t("beforeExit", this.localeLanguage),
|
|
383
|
+
import_opticore_translator2.TranslationLoader.t("processBeforeExit", this.localeLanguage),
|
|
331
384
|
this.stackTrace.stack,
|
|
332
385
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
333
386
|
);
|
|
@@ -336,16 +389,16 @@ var ServerListenEventError = class {
|
|
|
336
389
|
/**
|
|
337
390
|
*
|
|
338
391
|
*/
|
|
339
|
-
|
|
392
|
+
processDisconnected() {
|
|
340
393
|
this.stackTrace = this.traceError(
|
|
341
|
-
import_opticore_translator2.TranslationLoader.t("childProcessDiscon",
|
|
342
|
-
import_opticore_translator2.TranslationLoader.t("processDiscon",
|
|
394
|
+
import_opticore_translator2.TranslationLoader.t("childProcessDiscon", this.localeLanguage),
|
|
395
|
+
import_opticore_translator2.TranslationLoader.t("processDiscon", this.localeLanguage),
|
|
343
396
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
344
397
|
);
|
|
345
398
|
this.logger.error(
|
|
346
399
|
this.stackTrace.message,
|
|
347
|
-
import_opticore_translator2.TranslationLoader.t("disconnected"),
|
|
348
|
-
import_opticore_translator2.TranslationLoader.t("processDiscon"),
|
|
400
|
+
import_opticore_translator2.TranslationLoader.t("disconnected", this.localeLanguage),
|
|
401
|
+
import_opticore_translator2.TranslationLoader.t("processDiscon", this.localeLanguage),
|
|
349
402
|
this.stackTrace.stack,
|
|
350
403
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
351
404
|
);
|
|
@@ -355,29 +408,29 @@ var ServerListenEventError = class {
|
|
|
355
408
|
*
|
|
356
409
|
* @param code
|
|
357
410
|
*/
|
|
358
|
-
|
|
411
|
+
exited(code) {
|
|
359
412
|
switch (code) {
|
|
360
413
|
case 0:
|
|
361
414
|
this.logger.success(
|
|
362
|
-
import_opticore_translator2.TranslationLoader.t("completed",
|
|
363
|
-
import_opticore_translator2.TranslationLoader.t("finishingProcessWell",
|
|
415
|
+
import_opticore_translator2.TranslationLoader.t("completed", this.localeLanguage, { code }),
|
|
416
|
+
import_opticore_translator2.TranslationLoader.t("finishingProcessWell", this.localeLanguage, { code })
|
|
364
417
|
);
|
|
365
418
|
console.log("");
|
|
366
419
|
const paddingLength = 35;
|
|
367
420
|
const msg0 = " ".padEnd(paddingLength, " ");
|
|
368
421
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
369
|
-
console.log(`${import_ansi_colors.default.bgGreen(` ${import_opticore_translator2.TranslationLoader.t("serverStopped",
|
|
422
|
+
console.log(`${import_ansi_colors.default.bgGreen(` ${import_opticore_translator2.TranslationLoader.t("serverStopped", this.localeLanguage)} `)}`);
|
|
370
423
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
371
424
|
break;
|
|
372
425
|
case 1:
|
|
373
426
|
this.stackTrace = this.traceError(
|
|
374
|
-
import_opticore_translator2.TranslationLoader.t("somethingWentWrong",
|
|
375
|
-
import_opticore_translator2.TranslationLoader.t("genErrors",
|
|
427
|
+
import_opticore_translator2.TranslationLoader.t("somethingWentWrong", this.localeLanguage),
|
|
428
|
+
import_opticore_translator2.TranslationLoader.t("genErrors", this.localeLanguage),
|
|
376
429
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
377
430
|
);
|
|
378
431
|
this.logger.error(
|
|
379
432
|
this.stackTrace.message,
|
|
380
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
433
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
381
434
|
"General Errors",
|
|
382
435
|
this.stackTrace.stack,
|
|
383
436
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -385,27 +438,27 @@ var ServerListenEventError = class {
|
|
|
385
438
|
break;
|
|
386
439
|
case 2:
|
|
387
440
|
this.stackTrace = this.traceError(
|
|
388
|
-
import_opticore_translator2.TranslationLoader.t("incorrectCmd",
|
|
389
|
-
import_opticore_translator2.TranslationLoader.t("misuseShell",
|
|
441
|
+
import_opticore_translator2.TranslationLoader.t("incorrectCmd", this.localeLanguage),
|
|
442
|
+
import_opticore_translator2.TranslationLoader.t("misuseShell", this.localeLanguage),
|
|
390
443
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
391
444
|
);
|
|
392
445
|
this.logger.error(
|
|
393
446
|
this.stackTrace.message,
|
|
394
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
395
|
-
import_opticore_translator2.TranslationLoader.t("incorrectCmd",
|
|
447
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
448
|
+
import_opticore_translator2.TranslationLoader.t("incorrectCmd", this.localeLanguage),
|
|
396
449
|
this.stackTrace.stack,
|
|
397
450
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
398
451
|
);
|
|
399
452
|
break;
|
|
400
453
|
case 126:
|
|
401
454
|
this.stackTrace = this.traceError(
|
|
402
|
-
import_opticore_translator2.TranslationLoader.t("incorrectCmd",
|
|
403
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotExecutable",
|
|
455
|
+
import_opticore_translator2.TranslationLoader.t("incorrectCmd", this.localeLanguage),
|
|
456
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotExecutable", this.localeLanguage),
|
|
404
457
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
405
458
|
);
|
|
406
459
|
this.logger.error(
|
|
407
460
|
this.stackTrace.message,
|
|
408
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
461
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
409
462
|
this.stackTrace.name,
|
|
410
463
|
this.stackTrace.stack,
|
|
411
464
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -413,13 +466,13 @@ var ServerListenEventError = class {
|
|
|
413
466
|
break;
|
|
414
467
|
case 127:
|
|
415
468
|
this.stackTrace = this.traceError(
|
|
416
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotFound",
|
|
417
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath",
|
|
469
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotFound", this.localeLanguage),
|
|
470
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath", this.localeLanguage),
|
|
418
471
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
419
472
|
);
|
|
420
473
|
this.logger.error(
|
|
421
474
|
this.stackTrace.message,
|
|
422
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
475
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
423
476
|
this.stackTrace.name,
|
|
424
477
|
this.stackTrace.stack,
|
|
425
478
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -427,13 +480,13 @@ var ServerListenEventError = class {
|
|
|
427
480
|
break;
|
|
428
481
|
case 128:
|
|
429
482
|
this.stackTrace = this.traceError(
|
|
430
|
-
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath",
|
|
431
|
-
import_opticore_translator2.TranslationLoader.t("argInvalid",
|
|
483
|
+
import_opticore_translator2.TranslationLoader.t("cmdNotFoundInSystemPath", this.localeLanguage),
|
|
484
|
+
import_opticore_translator2.TranslationLoader.t("argInvalid", this.localeLanguage),
|
|
432
485
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
433
486
|
);
|
|
434
487
|
this.logger.error(
|
|
435
488
|
this.stackTrace.message,
|
|
436
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
489
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
437
490
|
this.stackTrace.name,
|
|
438
491
|
this.stackTrace.stack,
|
|
439
492
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -441,13 +494,13 @@ var ServerListenEventError = class {
|
|
|
441
494
|
break;
|
|
442
495
|
case 130:
|
|
443
496
|
this.stackTrace = this.traceError(
|
|
444
|
-
import_opticore_translator2.TranslationLoader.t("scriptEndedManuallyByCtrlC",
|
|
445
|
-
import_opticore_translator2.TranslationLoader.t("scriptEnded",
|
|
497
|
+
import_opticore_translator2.TranslationLoader.t("scriptEndedManuallyByCtrlC", this.localeLanguage),
|
|
498
|
+
import_opticore_translator2.TranslationLoader.t("scriptEnded", this.localeLanguage),
|
|
446
499
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
447
500
|
);
|
|
448
501
|
this.logger.error(
|
|
449
502
|
this.stackTrace.message,
|
|
450
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
503
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
451
504
|
this.stackTrace.name,
|
|
452
505
|
this.stackTrace.stack,
|
|
453
506
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -455,13 +508,13 @@ var ServerListenEventError = class {
|
|
|
455
508
|
break;
|
|
456
509
|
case 137:
|
|
457
510
|
this.stackTrace = this.traceError(
|
|
458
|
-
import_opticore_translator2.TranslationLoader.t("processEndedBySIGKILL",
|
|
511
|
+
import_opticore_translator2.TranslationLoader.t("processEndedBySIGKILL", this.localeLanguage),
|
|
459
512
|
"SIGKILL",
|
|
460
513
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
461
514
|
);
|
|
462
515
|
this.logger.error(
|
|
463
516
|
this.stackTrace.message,
|
|
464
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
517
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
465
518
|
this.stackTrace.name,
|
|
466
519
|
this.stackTrace.stack,
|
|
467
520
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -469,13 +522,13 @@ var ServerListenEventError = class {
|
|
|
469
522
|
break;
|
|
470
523
|
case 139:
|
|
471
524
|
this.stackTrace = this.traceError(
|
|
472
|
-
import_opticore_translator2.TranslationLoader.t("accessProcessIllegally",
|
|
473
|
-
import_opticore_translator2.TranslationLoader.t("defaultSegment",
|
|
525
|
+
import_opticore_translator2.TranslationLoader.t("accessProcessIllegally", this.localeLanguage),
|
|
526
|
+
import_opticore_translator2.TranslationLoader.t("defaultSegment", this.localeLanguage),
|
|
474
527
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
475
528
|
);
|
|
476
529
|
this.logger.error(
|
|
477
530
|
this.stackTrace.message,
|
|
478
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
531
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
479
532
|
this.stackTrace.name,
|
|
480
533
|
this.stackTrace.stack,
|
|
481
534
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -483,13 +536,13 @@ var ServerListenEventError = class {
|
|
|
483
536
|
break;
|
|
484
537
|
case 143:
|
|
485
538
|
this.stackTrace = this.traceError(
|
|
486
|
-
import_opticore_translator2.TranslationLoader.t("processReceivedSigtermSignal",
|
|
487
|
-
import_opticore_translator2.TranslationLoader.t("processReceived",
|
|
539
|
+
import_opticore_translator2.TranslationLoader.t("processReceivedSigtermSignal", this.localeLanguage),
|
|
540
|
+
import_opticore_translator2.TranslationLoader.t("processReceived", this.localeLanguage),
|
|
488
541
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
489
542
|
);
|
|
490
543
|
this.logger.error(
|
|
491
544
|
this.stackTrace.message,
|
|
492
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
545
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
493
546
|
this.stackTrace.name,
|
|
494
547
|
this.stackTrace.stack,
|
|
495
548
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -497,13 +550,13 @@ var ServerListenEventError = class {
|
|
|
497
550
|
break;
|
|
498
551
|
case 255:
|
|
499
552
|
this.stackTrace = this.traceError(
|
|
500
|
-
import_opticore_translator2.TranslationLoader.t("exitCode",
|
|
501
|
-
import_opticore_translator2.TranslationLoader.t("outRange",
|
|
553
|
+
import_opticore_translator2.TranslationLoader.t("exitCode", this.localeLanguage),
|
|
554
|
+
import_opticore_translator2.TranslationLoader.t("outRange", this.localeLanguage),
|
|
502
555
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
503
556
|
);
|
|
504
557
|
this.logger.error(
|
|
505
558
|
this.stackTrace.message,
|
|
506
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
559
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
507
560
|
this.stackTrace.name,
|
|
508
561
|
this.stackTrace.stack,
|
|
509
562
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -511,13 +564,13 @@ var ServerListenEventError = class {
|
|
|
511
564
|
break;
|
|
512
565
|
default:
|
|
513
566
|
this.stackTrace = this.traceError(
|
|
514
|
-
import_opticore_translator2.TranslationLoader.t("errorOccurring",
|
|
515
|
-
import_opticore_translator2.TranslationLoader.t("errors",
|
|
567
|
+
import_opticore_translator2.TranslationLoader.t("errorOccurring", this.localeLanguage),
|
|
568
|
+
import_opticore_translator2.TranslationLoader.t("errors", this.localeLanguage),
|
|
516
569
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
517
570
|
);
|
|
518
571
|
this.logger.error(
|
|
519
572
|
this.stackTrace.message,
|
|
520
|
-
import_opticore_translator2.TranslationLoader.t("exited",
|
|
573
|
+
import_opticore_translator2.TranslationLoader.t("exited", this.localeLanguage),
|
|
521
574
|
this.stackTrace.name,
|
|
522
575
|
this.stackTrace.stack,
|
|
523
576
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -529,11 +582,11 @@ var ServerListenEventError = class {
|
|
|
529
582
|
*
|
|
530
583
|
* @param promise
|
|
531
584
|
*/
|
|
532
|
-
|
|
585
|
+
promiseRejectionHandled(promise) {
|
|
533
586
|
try {
|
|
534
587
|
this.stackTrace = this.traceError(
|
|
535
|
-
import_opticore_translator2.TranslationLoader.t("promise",
|
|
536
|
-
import_opticore_translator2.TranslationLoader.t("rejectionPromise",
|
|
588
|
+
import_opticore_translator2.TranslationLoader.t("promise", this.localeLanguage, { promise }),
|
|
589
|
+
import_opticore_translator2.TranslationLoader.t("rejectionPromise", this.localeLanguage, { promise }),
|
|
537
590
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
538
591
|
);
|
|
539
592
|
this.logger.error(
|
|
@@ -550,13 +603,13 @@ var ServerListenEventError = class {
|
|
|
550
603
|
*
|
|
551
604
|
* @param error
|
|
552
605
|
*/
|
|
553
|
-
|
|
606
|
+
uncaughtException(error) {
|
|
554
607
|
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
608
|
console.log("");
|
|
556
609
|
} else {
|
|
557
610
|
this.stackTrace = this.traceError(
|
|
558
|
-
import_opticore_translator2.TranslationLoader.t(error.message),
|
|
559
|
-
import_opticore_translator2.TranslationLoader.t("uncaughtExceptionHandled",
|
|
611
|
+
import_opticore_translator2.TranslationLoader.t(error.message, this.localeLanguage, { error: error.stack }),
|
|
612
|
+
import_opticore_translator2.TranslationLoader.t("uncaughtExceptionHandled", this.localeLanguage),
|
|
560
613
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
561
614
|
);
|
|
562
615
|
this.logger.error(
|
|
@@ -572,7 +625,7 @@ var ServerListenEventError = class {
|
|
|
572
625
|
*
|
|
573
626
|
* @param error
|
|
574
627
|
*/
|
|
575
|
-
|
|
628
|
+
uncaughtExceptionMonitor(error) {
|
|
576
629
|
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.") {
|
|
577
630
|
console.log("");
|
|
578
631
|
}
|
|
@@ -582,10 +635,10 @@ var ServerListenEventError = class {
|
|
|
582
635
|
* @param reason
|
|
583
636
|
* @param promise
|
|
584
637
|
*/
|
|
585
|
-
|
|
638
|
+
unhandledRejection(reason, promise) {
|
|
586
639
|
this.stackTrace = this.traceError(
|
|
587
|
-
import_opticore_translator2.TranslationLoader.t("unhandledRejectionAtPromise",
|
|
588
|
-
import_opticore_translator2.TranslationLoader.t("unhandledRejection",
|
|
640
|
+
import_opticore_translator2.TranslationLoader.t("unhandledRejectionAtPromise", this.localeLanguage, { promise, reason }),
|
|
641
|
+
import_opticore_translator2.TranslationLoader.t("unhandledRejection", this.localeLanguage, { promise, reason }),
|
|
589
642
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
590
643
|
);
|
|
591
644
|
this.logger.error(
|
|
@@ -600,15 +653,15 @@ var ServerListenEventError = class {
|
|
|
600
653
|
*
|
|
601
654
|
* @param warning
|
|
602
655
|
*/
|
|
603
|
-
|
|
656
|
+
warning(warning) {
|
|
604
657
|
this.stackTrace = this.traceError(
|
|
605
|
-
import_opticore_translator2.TranslationLoader.t(warning.message,
|
|
658
|
+
import_opticore_translator2.TranslationLoader.t(warning.message, this.localeLanguage),
|
|
606
659
|
"warning",
|
|
607
660
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
608
661
|
);
|
|
609
662
|
this.logger.error(
|
|
610
663
|
this.stackTrace.message,
|
|
611
|
-
import_opticore_translator2.TranslationLoader.t("warning",
|
|
664
|
+
import_opticore_translator2.TranslationLoader.t("warning", this.localeLanguage, { warning }),
|
|
612
665
|
this.stackTrace.name,
|
|
613
666
|
this.stackTrace.stack,
|
|
614
667
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -618,10 +671,10 @@ var ServerListenEventError = class {
|
|
|
618
671
|
*
|
|
619
672
|
* @param message
|
|
620
673
|
*/
|
|
621
|
-
|
|
674
|
+
message(message) {
|
|
622
675
|
this.stackTrace = this.traceError(
|
|
623
|
-
import_opticore_translator2.TranslationLoader.t("processGotMsg",
|
|
624
|
-
import_opticore_translator2.TranslationLoader.t("msgException",
|
|
676
|
+
import_opticore_translator2.TranslationLoader.t("processGotMsg", this.localeLanguage, { message }),
|
|
677
|
+
import_opticore_translator2.TranslationLoader.t("msgException", this.localeLanguage, { message }),
|
|
625
678
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
626
679
|
);
|
|
627
680
|
this.logger.error(
|
|
@@ -638,10 +691,10 @@ var ServerListenEventError = class {
|
|
|
638
691
|
* @param promise
|
|
639
692
|
* @param reason
|
|
640
693
|
*/
|
|
641
|
-
|
|
694
|
+
multipleResolves(type, promise, reason) {
|
|
642
695
|
this.stackTrace = this.traceError(
|
|
643
|
-
import_opticore_translator2.TranslationLoader.t("promiseReason",
|
|
644
|
-
import_opticore_translator2.TranslationLoader.t("multipleResolvesDetected",
|
|
696
|
+
import_opticore_translator2.TranslationLoader.t("promiseReason", this.localeLanguage, { promise, reason }),
|
|
697
|
+
import_opticore_translator2.TranslationLoader.t("multipleResolvesDetected", this.localeLanguage, { type, promise, reason }),
|
|
645
698
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
646
699
|
);
|
|
647
700
|
this.logger.error(
|
|
@@ -655,17 +708,21 @@ var ServerListenEventError = class {
|
|
|
655
708
|
/**
|
|
656
709
|
*
|
|
657
710
|
*/
|
|
658
|
-
|
|
659
|
-
this.logger.success(
|
|
711
|
+
processInterrupted() {
|
|
712
|
+
this.logger.success(
|
|
713
|
+
import_opticore_translator2.TranslationLoader.t("okSuccess", this.localeLanguage),
|
|
714
|
+
import_opticore_translator2.TranslationLoader.t("serverWebStopped", this.localeLanguage)
|
|
715
|
+
);
|
|
660
716
|
import_process.default.exit(0);
|
|
661
717
|
}
|
|
662
718
|
/**
|
|
663
719
|
*
|
|
664
720
|
* @param signal
|
|
721
|
+
* @param defaultLocalLang
|
|
665
722
|
*/
|
|
666
|
-
|
|
723
|
+
sigtermSignalReceived(signal, defaultLocalLang) {
|
|
667
724
|
this.stackTrace = this.traceError(
|
|
668
|
-
import_opticore_translator2.TranslationLoader.t("processPIDReceivedSignal",
|
|
725
|
+
import_opticore_translator2.TranslationLoader.t("processPIDReceivedSignal", defaultLocalLang, { signal: signal.toString() }),
|
|
669
726
|
"SIGTERM",
|
|
670
727
|
import_opticore_http_response11.HttpStatusCode.NOT_ACCEPTABLE
|
|
671
728
|
);
|
|
@@ -681,16 +738,16 @@ var ServerListenEventError = class {
|
|
|
681
738
|
/**
|
|
682
739
|
*
|
|
683
740
|
*/
|
|
684
|
-
|
|
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",
|
|
741
|
+
serverClosing() {
|
|
742
|
+
console.log(`${import_ansi_colors.default.bgCyanBright(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(` INFO `)}`)}`)} ${import_opticore_translator2.TranslationLoader.t("allProcessStopped", this.localeLanguage)}`);
|
|
743
|
+
console.log(` ${import_opticore_translator2.TranslationLoader.t("serverClosed", this.localeLanguage)}`);
|
|
687
744
|
import_process.default.exit();
|
|
688
745
|
}
|
|
689
746
|
/**
|
|
690
747
|
*
|
|
691
748
|
*/
|
|
692
|
-
|
|
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",
|
|
749
|
+
dropNewConnection() {
|
|
750
|
+
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", this.localeLanguage)} `)}`)} `)} ${dateTimeFormatted} | ${import_ansi_colors.default.bgCyan(`${import_ansi_colors.default.white(` Info `)}`)} ${import_opticore_translator2.TranslationLoader.t("serverDroppedCon", this.localeLanguage)}`);
|
|
694
751
|
}
|
|
695
752
|
/**
|
|
696
753
|
*
|
|
@@ -700,28 +757,28 @@ var ServerListenEventError = class {
|
|
|
700
757
|
* @param res
|
|
701
758
|
* @param next
|
|
702
759
|
*/
|
|
703
|
-
|
|
760
|
+
expressErrorHandlingMiddleware(errorEmitter, err, req, res, next) {
|
|
704
761
|
if (err) {
|
|
705
762
|
errorEmitter.emit(CEventNameError.error, err);
|
|
706
763
|
if (typeof res.status === "function") {
|
|
707
|
-
res.status(500).send(import_opticore_translator2.TranslationLoader.t("internalServerError",
|
|
764
|
+
res.status(500).send(import_opticore_translator2.TranslationLoader.t("internalServerError", this.localeLanguage, { err }));
|
|
708
765
|
} else {
|
|
709
766
|
this.logger.error(
|
|
710
|
-
import_opticore_translator2.TranslationLoader.t("resStatusNotFunc",
|
|
767
|
+
import_opticore_translator2.TranslationLoader.t("resStatusNotFunc", this.localeLanguage, { err }),
|
|
711
768
|
"response status",
|
|
712
|
-
import_opticore_translator2.TranslationLoader.t("respndNotFunc",
|
|
769
|
+
import_opticore_translator2.TranslationLoader.t("respndNotFunc", this.localeLanguage, { err }),
|
|
713
770
|
err.stack,
|
|
714
771
|
import_opticore_http_response11.HttpStatusCode.NOT_ACCEPTABLE
|
|
715
772
|
);
|
|
716
773
|
}
|
|
717
774
|
this.stackTrace = this.traceError(
|
|
718
775
|
err.message,
|
|
719
|
-
import_opticore_translator2.TranslationLoader.t("expressError",
|
|
776
|
+
import_opticore_translator2.TranslationLoader.t("expressError", this.localeLanguage, { err }),
|
|
720
777
|
import_opticore_http_response11.HttpStatusCode.NOT_ACCEPTABLE
|
|
721
778
|
);
|
|
722
779
|
this.logger.error(
|
|
723
780
|
this.stackTrace.message,
|
|
724
|
-
import_opticore_translator2.TranslationLoader.t("expressErrorHandlingMiddleware",
|
|
781
|
+
import_opticore_translator2.TranslationLoader.t("expressErrorHandlingMiddleware", this.localeLanguage, { err }),
|
|
725
782
|
this.stackTrace.name,
|
|
726
783
|
this.stackTrace.stack,
|
|
727
784
|
import_opticore_http_response11.HttpStatusCode.SERVICE_UNAVAILABLE
|
|
@@ -730,8 +787,216 @@ var ServerListenEventError = class {
|
|
|
730
787
|
next();
|
|
731
788
|
}
|
|
732
789
|
}
|
|
733
|
-
|
|
734
|
-
return new StackTraceError(props, name,
|
|
790
|
+
traceError(props, name, status38) {
|
|
791
|
+
return new StackTraceError(props, name, status38, true);
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
// src/core/errors/stackTraceEACCES.ts
|
|
796
|
+
var import_opticore_http_response12 = require("opticore-http-response");
|
|
797
|
+
var StackTraceEACCES = class extends StackTraceError {
|
|
798
|
+
constructor(message) {
|
|
799
|
+
super(message, CErrorName.eacces, import_opticore_http_response12.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// src/core/errors/stackTraceEADDRINUSE.ts
|
|
804
|
+
var import_opticore_http_response13 = require("opticore-http-response");
|
|
805
|
+
var StackTraceEADDRINUSE = class extends StackTraceError {
|
|
806
|
+
constructor(message) {
|
|
807
|
+
super(message, CErrorName.eaddrinuse, import_opticore_http_response13.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
// src/core/errors/stackTraceECONNREFUSED.ts
|
|
812
|
+
var import_opticore_http_response14 = require("opticore-http-response");
|
|
813
|
+
var StackTraceECONNREFUSED = class extends StackTraceError {
|
|
814
|
+
constructor(message) {
|
|
815
|
+
super(message, CErrorName.econnrefused, import_opticore_http_response14.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
// src/core/errors/stackTraceECONNRESET.ts
|
|
820
|
+
var import_opticore_http_response15 = require("opticore-http-response");
|
|
821
|
+
var StackTraceECONNRESET = class extends StackTraceError {
|
|
822
|
+
constructor(message) {
|
|
823
|
+
super(message, CErrorName.econnreset, import_opticore_http_response15.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
// src/core/errors/stackTraceEEXIST.ts
|
|
828
|
+
var import_opticore_http_response16 = require("opticore-http-response");
|
|
829
|
+
var StackTraceEEXIST = class extends StackTraceError {
|
|
830
|
+
constructor(message) {
|
|
831
|
+
super(message, CErrorName.eexist, import_opticore_http_response16.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
// src/core/errors/stackTraceEISDIR.ts
|
|
836
|
+
var import_opticore_http_response17 = require("opticore-http-response");
|
|
837
|
+
var StackTraceEISDIR = class extends StackTraceError {
|
|
838
|
+
constructor(message) {
|
|
839
|
+
super(message, CErrorName.eisdir, import_opticore_http_response17.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
// src/core/errors/stackTraceEMFILE.ts
|
|
844
|
+
var import_opticore_http_response18 = require("opticore-http-response");
|
|
845
|
+
var StackTraceEMFILE = class extends StackTraceError {
|
|
846
|
+
constructor(message) {
|
|
847
|
+
super(message, CErrorName.emfile, import_opticore_http_response18.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
// src/core/errors/stackTraceENOENT.ts
|
|
852
|
+
var import_opticore_http_response19 = require("opticore-http-response");
|
|
853
|
+
var StackTraceENOENT = class extends StackTraceError {
|
|
854
|
+
constructor(message) {
|
|
855
|
+
super(message, CErrorName.enoent, import_opticore_http_response19.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
// src/core/errors/stackTraceENOTDIR.ts
|
|
860
|
+
var import_opticore_http_response20 = require("opticore-http-response");
|
|
861
|
+
var StackTraceENOTDIR = class extends StackTraceError {
|
|
862
|
+
constructor(message) {
|
|
863
|
+
super(message, CErrorName.enotdir, import_opticore_http_response20.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
// src/core/errors/stackTraceENOTEMPTY.ts
|
|
868
|
+
var import_opticore_http_response21 = require("opticore-http-response");
|
|
869
|
+
var StackTraceENOTEMPTY = class extends StackTraceError {
|
|
870
|
+
constructor(message) {
|
|
871
|
+
super(message, CErrorName.enotEmpty, import_opticore_http_response21.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
// src/core/errors/stackTraceEPERM.ts
|
|
876
|
+
var import_opticore_http_response22 = require("opticore-http-response");
|
|
877
|
+
var StackTraceEPERM = class extends StackTraceError {
|
|
878
|
+
constructor(message) {
|
|
879
|
+
super(message, CErrorName.eperm, import_opticore_http_response22.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// src/core/errors/stackTraceEPIPE.ts
|
|
884
|
+
var import_opticore_http_response23 = require("opticore-http-response");
|
|
885
|
+
var StackTraceEPIPE = class extends StackTraceError {
|
|
886
|
+
constructor(message) {
|
|
887
|
+
super(message, CErrorName.epipe, import_opticore_http_response23.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
// src/core/errors/stackTraceETIMEDOUT.ts
|
|
892
|
+
var import_opticore_http_response24 = require("opticore-http-response");
|
|
893
|
+
var StackTraceETIMEDOUT = class extends StackTraceError {
|
|
894
|
+
constructor(message) {
|
|
895
|
+
super(message, CErrorName.etimedout, import_opticore_http_response24.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
// src/core/errors/stackTraceERR_OSSL_EVP_UNSUPPORTED.ts
|
|
900
|
+
var import_opticore_http_response25 = require("opticore-http-response");
|
|
901
|
+
var StackTraceERR_OSSL_EVP_UNSUPPORTED = class extends StackTraceError {
|
|
902
|
+
constructor(message) {
|
|
903
|
+
super(message, CErrorName.errOsslEvpUnsupported, import_opticore_http_response25.HttpStatusCode.NOT_ACCEPTABLE, true);
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
// src/core/errors/stackTraceERR_OSSL_BAD_DECRYPT.ts
|
|
908
|
+
var import_opticore_http_response26 = require("opticore-http-response");
|
|
909
|
+
var StackTraceERR_OSSL_BAD_DECRYPT = class extends StackTraceError {
|
|
910
|
+
constructor(message) {
|
|
911
|
+
super(message, CErrorName.errOsslBadDecrypt, import_opticore_http_response26.HttpStatusCode.BAD_REQUEST, true);
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
// src/core/errors/stackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH.ts
|
|
916
|
+
var import_opticore_http_response27 = require("opticore-http-response");
|
|
917
|
+
var StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH = class extends StackTraceError {
|
|
918
|
+
constructor(message) {
|
|
919
|
+
super(message, CErrorName.errOsslWrongFinalBlockLength, import_opticore_http_response27.HttpStatusCode.NOT_ACCEPTABLE, true);
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
// src/core/errors/stackTraceERR_INVALID_ARG_TYPE.ts
|
|
924
|
+
var import_opticore_http_response28 = require("opticore-http-response");
|
|
925
|
+
var StackTraceERR_INVALID_ARG_TYPE = class extends StackTraceError {
|
|
926
|
+
constructor(message) {
|
|
927
|
+
super(message, CErrorName.errInvalidArgType, import_opticore_http_response28.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
// src/core/errors/stackTraceERR_INVALID_CALLBACK.ts
|
|
932
|
+
var import_opticore_http_response29 = require("opticore-http-response");
|
|
933
|
+
var StackTraceERR_INVALID_CALLBACK = class extends StackTraceError {
|
|
934
|
+
constructor(message) {
|
|
935
|
+
super(message, CErrorName.errInvalidCallback, import_opticore_http_response29.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
// src/core/errors/stackTraceERR_HTTP_HEADERS_SENT.ts
|
|
940
|
+
var import_opticore_http_response30 = require("opticore-http-response");
|
|
941
|
+
var StackTraceERR_HTTP_HEADERS_SENT = class extends StackTraceError {
|
|
942
|
+
constructor(message) {
|
|
943
|
+
super(message, CErrorName.errHttpHeadersSent, import_opticore_http_response30.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
// src/core/errors/stackTraceERR_STREAM_DESTROYED.ts
|
|
948
|
+
var import_opticore_http_response31 = require("opticore-http-response");
|
|
949
|
+
var StackTraceERR_STREAM_DESTROYED = class extends StackTraceError {
|
|
950
|
+
constructor(message) {
|
|
951
|
+
super(message, CErrorName.errStreamDestroyed, import_opticore_http_response31.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
// src/core/errors/stackTraceERR_TLS_CERT_ALTNAME_INVALID.ts
|
|
956
|
+
var import_opticore_http_response32 = require("opticore-http-response");
|
|
957
|
+
var StackTraceERR_TLS_CERT_ALTNAME_INVALID = class extends StackTraceError {
|
|
958
|
+
constructor(message) {
|
|
959
|
+
super(message, CErrorName.errTlsCertAltnameInvalid, import_opticore_http_response32.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
// src/core/errors/stackTraceERR_UNSUPPORTED_ESM_URL_SCHEME.ts
|
|
964
|
+
var import_opticore_http_response33 = require("opticore-http-response");
|
|
965
|
+
var StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME = class extends StackTraceError {
|
|
966
|
+
constructor(message) {
|
|
967
|
+
super(message, CErrorName.errUnsupportedEsmUrlScheme, import_opticore_http_response33.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
// src/core/errors/stackTraceUncaughtException.ts
|
|
972
|
+
var import_opticore_http_response34 = require("opticore-http-response");
|
|
973
|
+
var StackTraceUncaughtException = class extends StackTraceError {
|
|
974
|
+
constructor(message) {
|
|
975
|
+
super(message, CEvent.uncaughtException, import_opticore_http_response34.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// src/core/errors/stackTraceUnhandledRejection.ts
|
|
980
|
+
var import_opticore_http_response35 = require("opticore-http-response");
|
|
981
|
+
var StackTraceUnhandledRejection = class extends StackTraceError {
|
|
982
|
+
constructor(message) {
|
|
983
|
+
super(message, CEvent.unhandledRejection, import_opticore_http_response35.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
// src/core/errors/stackTraceBeforeExit.ts
|
|
988
|
+
var import_opticore_http_response36 = require("opticore-http-response");
|
|
989
|
+
var StackTraceBeforeExit = class extends StackTraceError {
|
|
990
|
+
constructor(message) {
|
|
991
|
+
super(message, CEvent.beforeExit, import_opticore_http_response36.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
// src/core/errors/stackTraceExit.ts
|
|
996
|
+
var import_opticore_http_response37 = require("opticore-http-response");
|
|
997
|
+
var StackTraceExit = class extends StackTraceError {
|
|
998
|
+
constructor(message) {
|
|
999
|
+
super(message, CEvent.exit, import_opticore_http_response37.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
735
1000
|
}
|
|
736
1001
|
};
|
|
737
1002
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -741,8 +1006,32 @@ var ServerListenEventError = class {
|
|
|
741
1006
|
CEventNameError,
|
|
742
1007
|
ServerListenEventError,
|
|
743
1008
|
StackTraceAssertionError,
|
|
1009
|
+
StackTraceBeforeExit,
|
|
1010
|
+
StackTraceEACCES,
|
|
1011
|
+
StackTraceEADDRINUSE,
|
|
1012
|
+
StackTraceECONNREFUSED,
|
|
1013
|
+
StackTraceECONNRESET,
|
|
1014
|
+
StackTraceEEXIST,
|
|
1015
|
+
StackTraceEISDIR,
|
|
1016
|
+
StackTraceEMFILE,
|
|
1017
|
+
StackTraceENOENT,
|
|
1018
|
+
StackTraceENOTDIR,
|
|
1019
|
+
StackTraceENOTEMPTY,
|
|
1020
|
+
StackTraceEPERM,
|
|
1021
|
+
StackTraceEPIPE,
|
|
1022
|
+
StackTraceERR_HTTP_HEADERS_SENT,
|
|
1023
|
+
StackTraceERR_INVALID_ARG_TYPE,
|
|
1024
|
+
StackTraceERR_INVALID_CALLBACK,
|
|
1025
|
+
StackTraceERR_OSSL_BAD_DECRYPT,
|
|
1026
|
+
StackTraceERR_OSSL_EVP_UNSUPPORTED,
|
|
1027
|
+
StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH,
|
|
1028
|
+
StackTraceERR_STREAM_DESTROYED,
|
|
1029
|
+
StackTraceERR_TLS_CERT_ALTNAME_INVALID,
|
|
1030
|
+
StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME,
|
|
1031
|
+
StackTraceETIMEDOUT,
|
|
744
1032
|
StackTraceError,
|
|
745
1033
|
StackTraceEvalError,
|
|
1034
|
+
StackTraceExit,
|
|
746
1035
|
StackTraceGeneralError,
|
|
747
1036
|
StackTraceOpenSSLError,
|
|
748
1037
|
StackTraceRangeError,
|
|
@@ -750,5 +1039,7 @@ var ServerListenEventError = class {
|
|
|
750
1039
|
StackTraceSyntaxError,
|
|
751
1040
|
StackTraceSystemError,
|
|
752
1041
|
StackTraceTypeError,
|
|
753
|
-
StackTraceURIError
|
|
1042
|
+
StackTraceURIError,
|
|
1043
|
+
StackTraceUncaughtException,
|
|
1044
|
+
StackTraceUnhandledRejection
|
|
754
1045
|
});
|