opticore-catch-exception-error 1.0.14 → 1.0.16
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 +481 -395
- package/dist/index.d.cts +68 -263
- package/dist/index.d.ts +68 -263
- package/dist/index.js +476 -358
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66,6 +66,14 @@ var CEventNameError = {
|
|
|
66
66
|
request: "request"
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
// src/core/errors/events/serverListen.event.error.ts
|
|
70
|
+
import process from "process";
|
|
71
|
+
import colors from "ansi-colors";
|
|
72
|
+
import chalk from "chalk";
|
|
73
|
+
import { LoggerCore } from "opticore-logger";
|
|
74
|
+
import { HttpStatusCode as status } from "opticore-http-response";
|
|
75
|
+
import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
|
|
76
|
+
|
|
69
77
|
// src/core/errors/base/stackTraceError.ts
|
|
70
78
|
var StackTraceError = class extends Error {
|
|
71
79
|
name;
|
|
@@ -88,95 +96,6 @@ var StackTraceError = class extends Error {
|
|
|
88
96
|
}
|
|
89
97
|
};
|
|
90
98
|
|
|
91
|
-
// src/core/errors/stackTraceAssertionError.ts
|
|
92
|
-
import { HttpStatusCode as status } from "opticore-http-response";
|
|
93
|
-
var StackTraceAssertionError = class extends StackTraceError {
|
|
94
|
-
constructor(message) {
|
|
95
|
-
super(message, CErrorName.assertionError, status.INTERNAL_SERVER_ERROR, true);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// src/core/errors/stackTraceEvalError.ts
|
|
100
|
-
import { HttpStatusCode as status2 } from "opticore-http-response";
|
|
101
|
-
var StackTraceEvalError = class extends StackTraceError {
|
|
102
|
-
constructor(message) {
|
|
103
|
-
super(message, CErrorName.evalError, status2.BAD_REQUEST, true);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// src/core/errors/stackTraceGeneralError.ts
|
|
108
|
-
import { HttpStatusCode as status3 } from "opticore-http-response";
|
|
109
|
-
var StackTraceGeneralError = class extends StackTraceError {
|
|
110
|
-
constructor(message) {
|
|
111
|
-
super(message, CErrorName.generalError, status3.INTERNAL_SERVER_ERROR, false);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// src/core/errors/stackTraceOpenSSLError.ts
|
|
116
|
-
import { HttpStatusCode as status4 } from "opticore-http-response";
|
|
117
|
-
var StackTraceOpenSSLError = class extends StackTraceError {
|
|
118
|
-
constructor(message) {
|
|
119
|
-
super(message, CErrorName.openSSLError, status4.INTERNAL_SERVER_ERROR, false);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// src/core/errors/stackTraceRangeError.ts
|
|
124
|
-
import { HttpStatusCode as status5 } from "opticore-http-response";
|
|
125
|
-
var StackTraceRangeError = class extends StackTraceError {
|
|
126
|
-
constructor(message) {
|
|
127
|
-
super(message, CErrorName.rangeError, status5.BAD_REQUEST, true);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// src/core/errors/stackTraceReferenceError.ts
|
|
132
|
-
import { HttpStatusCode as status6 } from "opticore-http-response";
|
|
133
|
-
var StackTraceReferenceError = class extends StackTraceError {
|
|
134
|
-
constructor(message) {
|
|
135
|
-
super(message, CErrorName.referenceError, status6.BAD_REQUEST, true);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// src/core/errors/stackTraceSyntaxError.ts
|
|
140
|
-
import { HttpStatusCode as status7 } from "opticore-http-response";
|
|
141
|
-
var StackTraceSyntaxError = class extends StackTraceError {
|
|
142
|
-
constructor(message) {
|
|
143
|
-
super(message, CErrorName.syntaxError, status7.BAD_REQUEST, true);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// src/core/errors/stackTraceSystemError.ts
|
|
148
|
-
import { HttpStatusCode as status8 } from "opticore-http-response";
|
|
149
|
-
var StackTraceSystemError = class extends StackTraceError {
|
|
150
|
-
constructor(message, code) {
|
|
151
|
-
super(message, CErrorName.systemError, status8.INTERNAL_SERVER_ERROR, false);
|
|
152
|
-
this.message = `${message} (code: ${code})`;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
// src/core/errors/stackTraceTypeError.ts
|
|
157
|
-
import { HttpStatusCode as status9 } from "opticore-http-response";
|
|
158
|
-
var StackTraceTypeError = class extends StackTraceError {
|
|
159
|
-
constructor(message) {
|
|
160
|
-
super(message, CErrorName.typeError, status9.BAD_REQUEST, true);
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// src/core/errors/stackTraceURIError.ts
|
|
165
|
-
import { HttpStatusCode as status10 } from "opticore-http-response";
|
|
166
|
-
var StackTraceURIError = class extends StackTraceError {
|
|
167
|
-
constructor(message) {
|
|
168
|
-
super(message, CErrorName.uriError, status10.BAD_REQUEST, true);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// src/core/errors/events/serverListen.event.error.ts
|
|
173
|
-
import process from "process";
|
|
174
|
-
import colors from "ansi-colors";
|
|
175
|
-
import chalk from "chalk";
|
|
176
|
-
import { LoggerCore } from "opticore-logger";
|
|
177
|
-
import { HttpStatusCode as status11 } from "opticore-http-response";
|
|
178
|
-
import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
|
|
179
|
-
|
|
180
99
|
// src/utils/dateTimeFormatted.utils.ts
|
|
181
100
|
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()}`;
|
|
182
101
|
|
|
@@ -184,11 +103,11 @@ var dateTimeFormatted = `${(/* @__PURE__ */ new Date()).getMonth()}-${(/* @__PUR
|
|
|
184
103
|
import path from "path";
|
|
185
104
|
import { createRequire } from "module";
|
|
186
105
|
import { TranslationLoader } from "opticore-translator";
|
|
187
|
-
var translateCatchExceptionErrorLanguageLoader = (
|
|
106
|
+
var translateCatchExceptionErrorLanguageLoader = () => {
|
|
188
107
|
const require2 = createRequire(import.meta.url);
|
|
189
108
|
const packagePath = path.dirname(require2.resolve("opticore-catch-exception-error"));
|
|
190
109
|
const translateMsgJsonFilePath = path.join(packagePath, "utils", "translations");
|
|
191
|
-
TranslationLoader.loadTranslations(translateMsgJsonFilePath
|
|
110
|
+
TranslationLoader.loadTranslations(translateMsgJsonFilePath);
|
|
192
111
|
};
|
|
193
112
|
|
|
194
113
|
// src/core/errors/events/serverListen.event.error.ts
|
|
@@ -198,7 +117,7 @@ var ServerListenEventError = class {
|
|
|
198
117
|
localeLanguage;
|
|
199
118
|
constructor(defaultLocalLang) {
|
|
200
119
|
this.localeLanguage = defaultLocalLang;
|
|
201
|
-
translateCatchExceptionErrorLanguageLoader(
|
|
120
|
+
translateCatchExceptionErrorLanguageLoader();
|
|
202
121
|
}
|
|
203
122
|
/**
|
|
204
123
|
* @param appPort
|
|
@@ -208,14 +127,14 @@ var ServerListenEventError = class {
|
|
|
208
127
|
this.stackTrace = this.traceError(
|
|
209
128
|
TranslationLoader2.t("errorHostUrl", this.localeLanguage),
|
|
210
129
|
TranslationLoader2.t("listening", this.localeLanguage),
|
|
211
|
-
|
|
130
|
+
status.BAD_REQUEST
|
|
212
131
|
);
|
|
213
132
|
this.logger.error(
|
|
214
133
|
this.stackTrace.message,
|
|
215
134
|
TranslationLoader2.t("webServer", this.localeLanguage),
|
|
216
135
|
TranslationLoader2.t("badPort", this.localeLanguage, { badPort: appPort }),
|
|
217
136
|
this.stackTrace.stack,
|
|
218
|
-
|
|
137
|
+
status.BAD_REQUEST
|
|
219
138
|
);
|
|
220
139
|
process.exit();
|
|
221
140
|
}
|
|
@@ -227,14 +146,14 @@ var ServerListenEventError = class {
|
|
|
227
146
|
this.stackTrace = this.traceError(
|
|
228
147
|
TranslationLoader2.t("badHost", this.localeLanguage, { badHost: appHost }),
|
|
229
148
|
TranslationLoader2.t("listening", this.localeLanguage),
|
|
230
|
-
|
|
149
|
+
status.BAD_REQUEST
|
|
231
150
|
);
|
|
232
151
|
this.logger.error(
|
|
233
152
|
this.stackTrace.message,
|
|
234
153
|
TranslationLoader2.t("webServer", this.localeLanguage),
|
|
235
154
|
TranslationLoader2.t("badHost", this.localeLanguage),
|
|
236
155
|
this.stackTrace.stack,
|
|
237
|
-
|
|
156
|
+
status.BAD_REQUEST
|
|
238
157
|
);
|
|
239
158
|
process.exit();
|
|
240
159
|
}
|
|
@@ -245,14 +164,14 @@ var ServerListenEventError = class {
|
|
|
245
164
|
this.stackTrace = this.traceError(
|
|
246
165
|
TranslationLoader2.t("badPort", this.localeLanguage),
|
|
247
166
|
TranslationLoader2.t("listening", this.localeLanguage),
|
|
248
|
-
|
|
167
|
+
status.BAD_REQUEST
|
|
249
168
|
);
|
|
250
169
|
this.logger.error(
|
|
251
170
|
this.stackTrace.message,
|
|
252
171
|
TranslationLoader2.t("webServer", this.localeLanguage),
|
|
253
172
|
TranslationLoader2.t("badHost", this.localeLanguage),
|
|
254
173
|
this.stackTrace.stack,
|
|
255
|
-
|
|
174
|
+
status.BAD_REQUEST
|
|
256
175
|
);
|
|
257
176
|
process.exit();
|
|
258
177
|
}
|
|
@@ -266,7 +185,7 @@ var ServerListenEventError = class {
|
|
|
266
185
|
TranslationLoader2.t("serverStart", this.localeLanguage),
|
|
267
186
|
TranslationLoader2.t("serverStartError", this.localeLanguage, { err }),
|
|
268
187
|
err.stack,
|
|
269
|
-
|
|
188
|
+
status.SERVICE_UNAVAILABLE
|
|
270
189
|
);
|
|
271
190
|
}
|
|
272
191
|
/**
|
|
@@ -277,14 +196,14 @@ var ServerListenEventError = class {
|
|
|
277
196
|
this.stackTrace = this.traceError(
|
|
278
197
|
error.message,
|
|
279
198
|
error.name,
|
|
280
|
-
|
|
199
|
+
status.BAD_REQUEST
|
|
281
200
|
);
|
|
282
201
|
this.logger.error(
|
|
283
202
|
this.stackTrace.message,
|
|
284
203
|
"Event error",
|
|
285
204
|
"Error",
|
|
286
205
|
error.stack,
|
|
287
|
-
|
|
206
|
+
status.BAD_REQUEST
|
|
288
207
|
);
|
|
289
208
|
}
|
|
290
209
|
/**
|
|
@@ -295,14 +214,14 @@ var ServerListenEventError = class {
|
|
|
295
214
|
this.stackTrace = this.traceError(
|
|
296
215
|
TranslationLoader2.t("processExitCode", this.localeLanguage, { processExitCode: code }),
|
|
297
216
|
TranslationLoader2.t("beforeExit", this.localeLanguage),
|
|
298
|
-
|
|
217
|
+
status.SERVICE_UNAVAILABLE
|
|
299
218
|
);
|
|
300
219
|
this.logger.error(
|
|
301
220
|
this.stackTrace.message,
|
|
302
221
|
TranslationLoader2.t("beforeExit", this.localeLanguage),
|
|
303
222
|
TranslationLoader2.t("processBeforeExit", this.localeLanguage),
|
|
304
223
|
this.stackTrace.stack,
|
|
305
|
-
|
|
224
|
+
status.SERVICE_UNAVAILABLE
|
|
306
225
|
);
|
|
307
226
|
process.exit(code);
|
|
308
227
|
}
|
|
@@ -313,14 +232,14 @@ var ServerListenEventError = class {
|
|
|
313
232
|
this.stackTrace = this.traceError(
|
|
314
233
|
TranslationLoader2.t("childProcessDiscon", this.localeLanguage),
|
|
315
234
|
TranslationLoader2.t("processDiscon", this.localeLanguage),
|
|
316
|
-
|
|
235
|
+
status.SERVICE_UNAVAILABLE
|
|
317
236
|
);
|
|
318
237
|
this.logger.error(
|
|
319
238
|
this.stackTrace.message,
|
|
320
239
|
TranslationLoader2.t("disconnected", this.localeLanguage),
|
|
321
240
|
TranslationLoader2.t("processDiscon", this.localeLanguage),
|
|
322
241
|
this.stackTrace.stack,
|
|
323
|
-
|
|
242
|
+
status.SERVICE_UNAVAILABLE
|
|
324
243
|
);
|
|
325
244
|
process.exit();
|
|
326
245
|
}
|
|
@@ -346,154 +265,154 @@ var ServerListenEventError = class {
|
|
|
346
265
|
this.stackTrace = this.traceError(
|
|
347
266
|
TranslationLoader2.t("somethingWentWrong", this.localeLanguage),
|
|
348
267
|
TranslationLoader2.t("genErrors", this.localeLanguage),
|
|
349
|
-
|
|
268
|
+
status.SERVICE_UNAVAILABLE
|
|
350
269
|
);
|
|
351
270
|
this.logger.error(
|
|
352
271
|
this.stackTrace.message,
|
|
353
272
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
354
273
|
"General Errors",
|
|
355
274
|
this.stackTrace.stack,
|
|
356
|
-
|
|
275
|
+
status.SERVICE_UNAVAILABLE
|
|
357
276
|
);
|
|
358
277
|
break;
|
|
359
278
|
case 2:
|
|
360
279
|
this.stackTrace = this.traceError(
|
|
361
280
|
TranslationLoader2.t("incorrectCmd", this.localeLanguage),
|
|
362
281
|
TranslationLoader2.t("misuseShell", this.localeLanguage),
|
|
363
|
-
|
|
282
|
+
status.SERVICE_UNAVAILABLE
|
|
364
283
|
);
|
|
365
284
|
this.logger.error(
|
|
366
285
|
this.stackTrace.message,
|
|
367
286
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
368
287
|
TranslationLoader2.t("incorrectCmd", this.localeLanguage),
|
|
369
288
|
this.stackTrace.stack,
|
|
370
|
-
|
|
289
|
+
status.SERVICE_UNAVAILABLE
|
|
371
290
|
);
|
|
372
291
|
break;
|
|
373
292
|
case 126:
|
|
374
293
|
this.stackTrace = this.traceError(
|
|
375
294
|
TranslationLoader2.t("incorrectCmd", this.localeLanguage),
|
|
376
295
|
TranslationLoader2.t("cmdNotExecutable", this.localeLanguage),
|
|
377
|
-
|
|
296
|
+
status.SERVICE_UNAVAILABLE
|
|
378
297
|
);
|
|
379
298
|
this.logger.error(
|
|
380
299
|
this.stackTrace.message,
|
|
381
300
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
382
301
|
this.stackTrace.name,
|
|
383
302
|
this.stackTrace.stack,
|
|
384
|
-
|
|
303
|
+
status.SERVICE_UNAVAILABLE
|
|
385
304
|
);
|
|
386
305
|
break;
|
|
387
306
|
case 127:
|
|
388
307
|
this.stackTrace = this.traceError(
|
|
389
308
|
TranslationLoader2.t("cmdNotFound", this.localeLanguage),
|
|
390
309
|
TranslationLoader2.t("cmdNotFoundInSystemPath", this.localeLanguage),
|
|
391
|
-
|
|
310
|
+
status.SERVICE_UNAVAILABLE
|
|
392
311
|
);
|
|
393
312
|
this.logger.error(
|
|
394
313
|
this.stackTrace.message,
|
|
395
314
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
396
315
|
this.stackTrace.name,
|
|
397
316
|
this.stackTrace.stack,
|
|
398
|
-
|
|
317
|
+
status.SERVICE_UNAVAILABLE
|
|
399
318
|
);
|
|
400
319
|
break;
|
|
401
320
|
case 128:
|
|
402
321
|
this.stackTrace = this.traceError(
|
|
403
322
|
TranslationLoader2.t("cmdNotFoundInSystemPath", this.localeLanguage),
|
|
404
323
|
TranslationLoader2.t("argInvalid", this.localeLanguage),
|
|
405
|
-
|
|
324
|
+
status.SERVICE_UNAVAILABLE
|
|
406
325
|
);
|
|
407
326
|
this.logger.error(
|
|
408
327
|
this.stackTrace.message,
|
|
409
328
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
410
329
|
this.stackTrace.name,
|
|
411
330
|
this.stackTrace.stack,
|
|
412
|
-
|
|
331
|
+
status.SERVICE_UNAVAILABLE
|
|
413
332
|
);
|
|
414
333
|
break;
|
|
415
334
|
case 130:
|
|
416
335
|
this.stackTrace = this.traceError(
|
|
417
336
|
TranslationLoader2.t("scriptEndedManuallyByCtrlC", this.localeLanguage),
|
|
418
337
|
TranslationLoader2.t("scriptEnded", this.localeLanguage),
|
|
419
|
-
|
|
338
|
+
status.SERVICE_UNAVAILABLE
|
|
420
339
|
);
|
|
421
340
|
this.logger.error(
|
|
422
341
|
this.stackTrace.message,
|
|
423
342
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
424
343
|
this.stackTrace.name,
|
|
425
344
|
this.stackTrace.stack,
|
|
426
|
-
|
|
345
|
+
status.SERVICE_UNAVAILABLE
|
|
427
346
|
);
|
|
428
347
|
break;
|
|
429
348
|
case 137:
|
|
430
349
|
this.stackTrace = this.traceError(
|
|
431
350
|
TranslationLoader2.t("processEndedBySIGKILL", this.localeLanguage),
|
|
432
351
|
"SIGKILL",
|
|
433
|
-
|
|
352
|
+
status.SERVICE_UNAVAILABLE
|
|
434
353
|
);
|
|
435
354
|
this.logger.error(
|
|
436
355
|
this.stackTrace.message,
|
|
437
356
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
438
357
|
this.stackTrace.name,
|
|
439
358
|
this.stackTrace.stack,
|
|
440
|
-
|
|
359
|
+
status.SERVICE_UNAVAILABLE
|
|
441
360
|
);
|
|
442
361
|
break;
|
|
443
362
|
case 139:
|
|
444
363
|
this.stackTrace = this.traceError(
|
|
445
364
|
TranslationLoader2.t("accessProcessIllegally", this.localeLanguage),
|
|
446
365
|
TranslationLoader2.t("defaultSegment", this.localeLanguage),
|
|
447
|
-
|
|
366
|
+
status.SERVICE_UNAVAILABLE
|
|
448
367
|
);
|
|
449
368
|
this.logger.error(
|
|
450
369
|
this.stackTrace.message,
|
|
451
370
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
452
371
|
this.stackTrace.name,
|
|
453
372
|
this.stackTrace.stack,
|
|
454
|
-
|
|
373
|
+
status.SERVICE_UNAVAILABLE
|
|
455
374
|
);
|
|
456
375
|
break;
|
|
457
376
|
case 143:
|
|
458
377
|
this.stackTrace = this.traceError(
|
|
459
378
|
TranslationLoader2.t("processReceivedSigtermSignal", this.localeLanguage),
|
|
460
379
|
TranslationLoader2.t("processReceived", this.localeLanguage),
|
|
461
|
-
|
|
380
|
+
status.SERVICE_UNAVAILABLE
|
|
462
381
|
);
|
|
463
382
|
this.logger.error(
|
|
464
383
|
this.stackTrace.message,
|
|
465
384
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
466
385
|
this.stackTrace.name,
|
|
467
386
|
this.stackTrace.stack,
|
|
468
|
-
|
|
387
|
+
status.SERVICE_UNAVAILABLE
|
|
469
388
|
);
|
|
470
389
|
break;
|
|
471
390
|
case 255:
|
|
472
391
|
this.stackTrace = this.traceError(
|
|
473
392
|
TranslationLoader2.t("exitCode", this.localeLanguage),
|
|
474
393
|
TranslationLoader2.t("outRange", this.localeLanguage),
|
|
475
|
-
|
|
394
|
+
status.SERVICE_UNAVAILABLE
|
|
476
395
|
);
|
|
477
396
|
this.logger.error(
|
|
478
397
|
this.stackTrace.message,
|
|
479
398
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
480
399
|
this.stackTrace.name,
|
|
481
400
|
this.stackTrace.stack,
|
|
482
|
-
|
|
401
|
+
status.SERVICE_UNAVAILABLE
|
|
483
402
|
);
|
|
484
403
|
break;
|
|
485
404
|
default:
|
|
486
405
|
this.stackTrace = this.traceError(
|
|
487
406
|
TranslationLoader2.t("errorOccurring", this.localeLanguage),
|
|
488
407
|
TranslationLoader2.t("errors", this.localeLanguage),
|
|
489
|
-
|
|
408
|
+
status.SERVICE_UNAVAILABLE
|
|
490
409
|
);
|
|
491
410
|
this.logger.error(
|
|
492
411
|
this.stackTrace.message,
|
|
493
412
|
TranslationLoader2.t("exited", this.localeLanguage),
|
|
494
413
|
this.stackTrace.name,
|
|
495
414
|
this.stackTrace.stack,
|
|
496
|
-
|
|
415
|
+
status.SERVICE_UNAVAILABLE
|
|
497
416
|
);
|
|
498
417
|
break;
|
|
499
418
|
}
|
|
@@ -507,14 +426,14 @@ var ServerListenEventError = class {
|
|
|
507
426
|
this.stackTrace = this.traceError(
|
|
508
427
|
TranslationLoader2.t("promise", this.localeLanguage, { promise }),
|
|
509
428
|
TranslationLoader2.t("rejectionPromise", this.localeLanguage, { promise }),
|
|
510
|
-
|
|
429
|
+
status.SERVICE_UNAVAILABLE
|
|
511
430
|
);
|
|
512
431
|
this.logger.error(
|
|
513
432
|
this.stackTrace.message,
|
|
514
433
|
"PromiseRejectionHandled",
|
|
515
434
|
this.stackTrace.name,
|
|
516
435
|
this.stackTrace.stack,
|
|
517
|
-
|
|
436
|
+
status.SERVICE_UNAVAILABLE
|
|
518
437
|
);
|
|
519
438
|
} catch (err) {
|
|
520
439
|
}
|
|
@@ -530,14 +449,14 @@ var ServerListenEventError = class {
|
|
|
530
449
|
this.stackTrace = this.traceError(
|
|
531
450
|
TranslationLoader2.t(error.message, this.localeLanguage, { error: error.stack }),
|
|
532
451
|
TranslationLoader2.t("uncaughtExceptionHandled", this.localeLanguage),
|
|
533
|
-
|
|
452
|
+
status.SERVICE_UNAVAILABLE
|
|
534
453
|
);
|
|
535
454
|
this.logger.error(
|
|
536
455
|
this.stackTrace.message,
|
|
537
456
|
"UncaughtException",
|
|
538
457
|
this.stackTrace.name,
|
|
539
458
|
this.stackTrace.stack,
|
|
540
|
-
|
|
459
|
+
status.SERVICE_UNAVAILABLE
|
|
541
460
|
);
|
|
542
461
|
}
|
|
543
462
|
}
|
|
@@ -559,14 +478,14 @@ var ServerListenEventError = class {
|
|
|
559
478
|
this.stackTrace = this.traceError(
|
|
560
479
|
TranslationLoader2.t("unhandledRejectionAtPromise", this.localeLanguage, { promise, reason }),
|
|
561
480
|
TranslationLoader2.t("unhandledRejection", this.localeLanguage, { promise, reason }),
|
|
562
|
-
|
|
481
|
+
status.SERVICE_UNAVAILABLE
|
|
563
482
|
);
|
|
564
483
|
this.logger.error(
|
|
565
484
|
this.stackTrace.message,
|
|
566
485
|
"UnhandledRejection",
|
|
567
486
|
this.stackTrace.name,
|
|
568
487
|
this.stackTrace.stack,
|
|
569
|
-
|
|
488
|
+
status.SERVICE_UNAVAILABLE
|
|
570
489
|
);
|
|
571
490
|
}
|
|
572
491
|
/**
|
|
@@ -577,14 +496,14 @@ var ServerListenEventError = class {
|
|
|
577
496
|
this.stackTrace = this.traceError(
|
|
578
497
|
TranslationLoader2.t(warning.message, this.localeLanguage),
|
|
579
498
|
"warning",
|
|
580
|
-
|
|
499
|
+
status.SERVICE_UNAVAILABLE
|
|
581
500
|
);
|
|
582
501
|
this.logger.error(
|
|
583
502
|
this.stackTrace.message,
|
|
584
503
|
TranslationLoader2.t("warning", this.localeLanguage, { warning }),
|
|
585
504
|
this.stackTrace.name,
|
|
586
505
|
this.stackTrace.stack,
|
|
587
|
-
|
|
506
|
+
status.SERVICE_UNAVAILABLE
|
|
588
507
|
);
|
|
589
508
|
}
|
|
590
509
|
/**
|
|
@@ -595,14 +514,14 @@ var ServerListenEventError = class {
|
|
|
595
514
|
this.stackTrace = this.traceError(
|
|
596
515
|
TranslationLoader2.t("processGotMsg", this.localeLanguage, { message }),
|
|
597
516
|
TranslationLoader2.t("msgException", this.localeLanguage, { message }),
|
|
598
|
-
|
|
517
|
+
status.SERVICE_UNAVAILABLE
|
|
599
518
|
);
|
|
600
519
|
this.logger.error(
|
|
601
520
|
this.stackTrace.message,
|
|
602
521
|
"Message",
|
|
603
522
|
this.stackTrace.name,
|
|
604
523
|
this.stackTrace.stack,
|
|
605
|
-
|
|
524
|
+
status.SERVICE_UNAVAILABLE
|
|
606
525
|
);
|
|
607
526
|
}
|
|
608
527
|
/**
|
|
@@ -615,14 +534,14 @@ var ServerListenEventError = class {
|
|
|
615
534
|
this.stackTrace = this.traceError(
|
|
616
535
|
TranslationLoader2.t("promiseReason", this.localeLanguage, { promise, reason }),
|
|
617
536
|
TranslationLoader2.t("multipleResolvesDetected", this.localeLanguage, { type, promise, reason }),
|
|
618
|
-
|
|
537
|
+
status.SERVICE_UNAVAILABLE
|
|
619
538
|
);
|
|
620
539
|
this.logger.error(
|
|
621
540
|
this.stackTrace.message,
|
|
622
541
|
"multipleResolves",
|
|
623
542
|
this.stackTrace.name,
|
|
624
543
|
this.stackTrace.stack,
|
|
625
|
-
|
|
544
|
+
status.SERVICE_UNAVAILABLE
|
|
626
545
|
);
|
|
627
546
|
}
|
|
628
547
|
/**
|
|
@@ -638,20 +557,19 @@ var ServerListenEventError = class {
|
|
|
638
557
|
/**
|
|
639
558
|
*
|
|
640
559
|
* @param signal
|
|
641
|
-
* @param defaultLocalLang
|
|
642
560
|
*/
|
|
643
|
-
sigtermSignalReceived(signal
|
|
561
|
+
sigtermSignalReceived(signal) {
|
|
644
562
|
this.stackTrace = this.traceError(
|
|
645
|
-
TranslationLoader2.t("processPIDReceivedSignal",
|
|
563
|
+
TranslationLoader2.t("processPIDReceivedSignal", this.localeLanguage, { signal: signal.toString() }),
|
|
646
564
|
"SIGTERM",
|
|
647
|
-
|
|
565
|
+
status.NOT_ACCEPTABLE
|
|
648
566
|
);
|
|
649
567
|
this.logger.error(
|
|
650
568
|
this.stackTrace.message,
|
|
651
569
|
"SIGTERM",
|
|
652
570
|
this.stackTrace.name,
|
|
653
571
|
this.stackTrace.stack,
|
|
654
|
-
|
|
572
|
+
status.NOT_ACCEPTABLE
|
|
655
573
|
);
|
|
656
574
|
process.exit(0);
|
|
657
575
|
}
|
|
@@ -688,277 +606,477 @@ var ServerListenEventError = class {
|
|
|
688
606
|
"response status",
|
|
689
607
|
TranslationLoader2.t("respndNotFunc", this.localeLanguage, { err }),
|
|
690
608
|
err.stack,
|
|
691
|
-
|
|
609
|
+
status.NOT_ACCEPTABLE
|
|
692
610
|
);
|
|
693
611
|
}
|
|
694
612
|
this.stackTrace = this.traceError(
|
|
695
613
|
err.message,
|
|
696
614
|
TranslationLoader2.t("expressError", this.localeLanguage, { err }),
|
|
697
|
-
|
|
615
|
+
status.NOT_ACCEPTABLE
|
|
698
616
|
);
|
|
699
617
|
this.logger.error(
|
|
700
618
|
this.stackTrace.message,
|
|
701
619
|
TranslationLoader2.t("expressErrorHandlingMiddleware", this.localeLanguage, { err }),
|
|
702
620
|
this.stackTrace.name,
|
|
703
621
|
this.stackTrace.stack,
|
|
704
|
-
|
|
622
|
+
status.SERVICE_UNAVAILABLE
|
|
705
623
|
);
|
|
706
624
|
} else {
|
|
707
625
|
next();
|
|
708
626
|
}
|
|
709
627
|
}
|
|
710
|
-
traceError(props, name,
|
|
711
|
-
return new StackTraceError(props, name,
|
|
628
|
+
traceError(props, name, status7) {
|
|
629
|
+
return new StackTraceError(props, name, status7, true);
|
|
712
630
|
}
|
|
713
631
|
};
|
|
714
632
|
|
|
715
|
-
// src/core/errors/
|
|
716
|
-
import {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
633
|
+
// src/core/errors/javaScript/javaScriptErrors.ts
|
|
634
|
+
import { LoggerCore as LoggerCore2 } from "opticore-logger";
|
|
635
|
+
import { HttpStatusCode as status2 } from "opticore-http-response";
|
|
636
|
+
import { TranslationLoader as TranslationLoader3 } from "opticore-translator";
|
|
637
|
+
var JavaScriptErrors = class {
|
|
638
|
+
logger = new LoggerCore2();
|
|
639
|
+
stackTrace;
|
|
640
|
+
localLanguage;
|
|
641
|
+
constructor(defaultLocalLang) {
|
|
642
|
+
this.localLanguage = defaultLocalLang;
|
|
720
643
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
644
|
+
allError(error) {
|
|
645
|
+
this.stackTrace = this.traceError(error.message, error.name, status2.INTERNAL_SERVER_ERROR);
|
|
646
|
+
this.logger.error(
|
|
647
|
+
TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
|
|
648
|
+
"Error",
|
|
649
|
+
this.stackTrace.name,
|
|
650
|
+
this.stackTrace.stack,
|
|
651
|
+
status2.INTERNAL_SERVER_ERROR
|
|
652
|
+
);
|
|
728
653
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
654
|
+
evalError(error) {
|
|
655
|
+
this.stackTrace = this.traceError(error.message, error.name, status2.INTERNAL_SERVER_ERROR);
|
|
656
|
+
this.logger.error(
|
|
657
|
+
TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
|
|
658
|
+
"EvalError",
|
|
659
|
+
this.stackTrace.name,
|
|
660
|
+
this.stackTrace.stack,
|
|
661
|
+
status2.INTERNAL_SERVER_ERROR
|
|
662
|
+
);
|
|
736
663
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
664
|
+
rangeError(error) {
|
|
665
|
+
this.stackTrace = this.traceError(error.message, error.name, status2.INTERNAL_SERVER_ERROR);
|
|
666
|
+
this.logger.error(
|
|
667
|
+
TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
|
|
668
|
+
"RangeError",
|
|
669
|
+
this.stackTrace.name,
|
|
670
|
+
this.stackTrace.stack,
|
|
671
|
+
status2.INTERNAL_SERVER_ERROR
|
|
672
|
+
);
|
|
744
673
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
674
|
+
referenceError(error) {
|
|
675
|
+
this.stackTrace = this.traceError(error.message, error.name, status2.INTERNAL_SERVER_ERROR);
|
|
676
|
+
this.logger.error(
|
|
677
|
+
TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
|
|
678
|
+
"ReferenceError",
|
|
679
|
+
this.stackTrace.name,
|
|
680
|
+
this.stackTrace.stack,
|
|
681
|
+
status2.INTERNAL_SERVER_ERROR
|
|
682
|
+
);
|
|
752
683
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
684
|
+
syntaxError(error) {
|
|
685
|
+
this.stackTrace = this.traceError(error.message, error.name, status2.INTERNAL_SERVER_ERROR);
|
|
686
|
+
this.logger.error(
|
|
687
|
+
TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
|
|
688
|
+
"SyntaxError",
|
|
689
|
+
this.stackTrace.name,
|
|
690
|
+
this.stackTrace.stack,
|
|
691
|
+
status2.INTERNAL_SERVER_ERROR
|
|
692
|
+
);
|
|
760
693
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
694
|
+
typeError(error) {
|
|
695
|
+
this.stackTrace = this.traceError(error.message, error.name, status2.INTERNAL_SERVER_ERROR);
|
|
696
|
+
this.logger.error(
|
|
697
|
+
TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
|
|
698
|
+
"TypeError",
|
|
699
|
+
this.stackTrace.name,
|
|
700
|
+
this.stackTrace.stack,
|
|
701
|
+
status2.INTERNAL_SERVER_ERROR
|
|
702
|
+
);
|
|
768
703
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
704
|
+
uRIError(error) {
|
|
705
|
+
this.stackTrace = this.traceError(error.message, error.name, status2.INTERNAL_SERVER_ERROR);
|
|
706
|
+
this.logger.error(
|
|
707
|
+
TranslationLoader3.t(this.stackTrace.message, this.localLanguage),
|
|
708
|
+
"URIError",
|
|
709
|
+
this.stackTrace.name,
|
|
710
|
+
this.stackTrace.stack,
|
|
711
|
+
status2.INTERNAL_SERVER_ERROR
|
|
712
|
+
);
|
|
776
713
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
// src/core/errors/stackTraceENOTDIR.ts
|
|
780
|
-
import { HttpStatusCode as status20 } from "opticore-http-response";
|
|
781
|
-
var StackTraceENOTDIR = class extends StackTraceError {
|
|
782
|
-
constructor(message) {
|
|
783
|
-
super(message, CErrorName.enotdir, status20.INTERNAL_SERVER_ERROR, true);
|
|
714
|
+
traceError(props, name, status7) {
|
|
715
|
+
return new StackTraceError(props, name, status7, true);
|
|
784
716
|
}
|
|
785
717
|
};
|
|
786
718
|
|
|
787
|
-
// src/core/errors/
|
|
788
|
-
import {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
719
|
+
// src/core/errors/system/systemErrors.ts
|
|
720
|
+
import { LoggerCore as LoggerCore3 } from "opticore-logger";
|
|
721
|
+
import { HttpStatusCode as status3 } from "opticore-http-response";
|
|
722
|
+
import { TranslationLoader as TranslationLoader4 } from "opticore-translator";
|
|
723
|
+
var SystemErrors = class {
|
|
724
|
+
logger = new LoggerCore3();
|
|
725
|
+
stackTrace;
|
|
726
|
+
localLanguage;
|
|
727
|
+
constructor(defaultLocalLang) {
|
|
728
|
+
this.localLanguage = defaultLocalLang;
|
|
792
729
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
730
|
+
eAcces(error) {
|
|
731
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
732
|
+
this.logger.error(
|
|
733
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
734
|
+
"EACCES",
|
|
735
|
+
this.stackTrace.name,
|
|
736
|
+
this.stackTrace.stack,
|
|
737
|
+
status3.INTERNAL_SERVER_ERROR
|
|
738
|
+
);
|
|
800
739
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
740
|
+
eAddrInUse(error) {
|
|
741
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
742
|
+
this.logger.error(
|
|
743
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
744
|
+
"EADDRINUSE",
|
|
745
|
+
this.stackTrace.name,
|
|
746
|
+
this.stackTrace.stack,
|
|
747
|
+
status3.INTERNAL_SERVER_ERROR
|
|
748
|
+
);
|
|
808
749
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
750
|
+
eConnRefused(error) {
|
|
751
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
752
|
+
this.logger.error(
|
|
753
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
754
|
+
"ECONNREFUSED",
|
|
755
|
+
this.stackTrace.name,
|
|
756
|
+
this.stackTrace.stack,
|
|
757
|
+
status3.INTERNAL_SERVER_ERROR
|
|
758
|
+
);
|
|
816
759
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
760
|
+
eConnReset(error) {
|
|
761
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
762
|
+
this.logger.error(
|
|
763
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
764
|
+
"ECONNRESET",
|
|
765
|
+
this.stackTrace.name,
|
|
766
|
+
this.stackTrace.stack,
|
|
767
|
+
status3.INTERNAL_SERVER_ERROR
|
|
768
|
+
);
|
|
824
769
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
770
|
+
eExist(error) {
|
|
771
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
772
|
+
this.logger.error(
|
|
773
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
774
|
+
"EEXIST",
|
|
775
|
+
this.stackTrace.name,
|
|
776
|
+
this.stackTrace.stack,
|
|
777
|
+
status3.INTERNAL_SERVER_ERROR
|
|
778
|
+
);
|
|
832
779
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
780
|
+
eIsDir(error) {
|
|
781
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
782
|
+
this.logger.error(
|
|
783
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
784
|
+
"EISDIR",
|
|
785
|
+
this.stackTrace.name,
|
|
786
|
+
this.stackTrace.stack,
|
|
787
|
+
status3.INTERNAL_SERVER_ERROR
|
|
788
|
+
);
|
|
840
789
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
790
|
+
eMFile(error) {
|
|
791
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
792
|
+
this.logger.error(
|
|
793
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
794
|
+
"EMFILE",
|
|
795
|
+
this.stackTrace.name,
|
|
796
|
+
this.stackTrace.stack,
|
|
797
|
+
status3.INTERNAL_SERVER_ERROR
|
|
798
|
+
);
|
|
848
799
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
800
|
+
eNoEnt(error) {
|
|
801
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
802
|
+
this.logger.error(
|
|
803
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
804
|
+
"ENOENT",
|
|
805
|
+
this.stackTrace.name,
|
|
806
|
+
this.stackTrace.stack,
|
|
807
|
+
status3.INTERNAL_SERVER_ERROR
|
|
808
|
+
);
|
|
856
809
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
810
|
+
eNotDir(error) {
|
|
811
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
812
|
+
this.logger.error(
|
|
813
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
814
|
+
"ENOTDIR",
|
|
815
|
+
this.stackTrace.name,
|
|
816
|
+
this.stackTrace.stack,
|
|
817
|
+
status3.INTERNAL_SERVER_ERROR
|
|
818
|
+
);
|
|
864
819
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
820
|
+
eNotEmpty(error) {
|
|
821
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
822
|
+
this.logger.error(
|
|
823
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
824
|
+
"ENOTEMPTY",
|
|
825
|
+
this.stackTrace.name,
|
|
826
|
+
this.stackTrace.stack,
|
|
827
|
+
status3.INTERNAL_SERVER_ERROR
|
|
828
|
+
);
|
|
872
829
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
830
|
+
ePerm(error) {
|
|
831
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
832
|
+
this.logger.error(
|
|
833
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
834
|
+
"EPERM",
|
|
835
|
+
this.stackTrace.name,
|
|
836
|
+
this.stackTrace.stack,
|
|
837
|
+
status3.INTERNAL_SERVER_ERROR
|
|
838
|
+
);
|
|
880
839
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
840
|
+
ePipe(error) {
|
|
841
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
842
|
+
this.logger.error(
|
|
843
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
844
|
+
"EPIPE",
|
|
845
|
+
this.stackTrace.name,
|
|
846
|
+
this.stackTrace.stack,
|
|
847
|
+
status3.INTERNAL_SERVER_ERROR
|
|
848
|
+
);
|
|
888
849
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
850
|
+
eTimedOut(error) {
|
|
851
|
+
this.stackTrace = this.traceError(error.message, error.name, status3.INTERNAL_SERVER_ERROR);
|
|
852
|
+
this.logger.error(
|
|
853
|
+
TranslationLoader4.t(this.stackTrace.message, this.localLanguage),
|
|
854
|
+
"ETIMEDOUT",
|
|
855
|
+
this.stackTrace.name,
|
|
856
|
+
this.stackTrace.stack,
|
|
857
|
+
status3.INTERNAL_SERVER_ERROR
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
traceError(props, name, status7) {
|
|
861
|
+
return new StackTraceError(props, name, status7, true);
|
|
896
862
|
}
|
|
897
863
|
};
|
|
898
864
|
|
|
899
|
-
// src/core/errors/
|
|
900
|
-
import {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
865
|
+
// src/core/errors/openSSL/openSSLErrors.ts
|
|
866
|
+
import { LoggerCore as LoggerCore4 } from "opticore-logger";
|
|
867
|
+
import { HttpStatusCode as status4 } from "opticore-http-response";
|
|
868
|
+
import { TranslationLoader as TranslationLoader5 } from "opticore-translator";
|
|
869
|
+
var OpenSSLErrors = class {
|
|
870
|
+
logger = new LoggerCore4();
|
|
871
|
+
stackTrace;
|
|
872
|
+
localLanguage;
|
|
873
|
+
constructor(defaultLocalLang) {
|
|
874
|
+
this.localLanguage = defaultLocalLang;
|
|
875
|
+
}
|
|
876
|
+
errOsSLEvpUnsupported(error) {
|
|
877
|
+
this.stackTrace = this.traceError(error.message, error.name, status4.INTERNAL_SERVER_ERROR);
|
|
878
|
+
this.logger.error(
|
|
879
|
+
TranslationLoader5.t(this.stackTrace.message, this.localLanguage),
|
|
880
|
+
"ERR_OSSL_EVP_UNSUPPORTED",
|
|
881
|
+
this.stackTrace.name,
|
|
882
|
+
this.stackTrace.stack,
|
|
883
|
+
status4.INTERNAL_SERVER_ERROR
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
errOsSLBadDecrypt(error) {
|
|
887
|
+
this.stackTrace = this.traceError(error.message, error.name, status4.INTERNAL_SERVER_ERROR);
|
|
888
|
+
this.logger.error(
|
|
889
|
+
TranslationLoader5.t(this.stackTrace.message, this.localLanguage),
|
|
890
|
+
"ERR_OSSL_BAD_DECRYPT",
|
|
891
|
+
this.stackTrace.name,
|
|
892
|
+
this.stackTrace.stack,
|
|
893
|
+
status4.INTERNAL_SERVER_ERROR
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
errOsSLWrongFinalBlockLength(error) {
|
|
897
|
+
this.stackTrace = this.traceError(error.message, error.name, status4.INTERNAL_SERVER_ERROR);
|
|
898
|
+
this.logger.error(
|
|
899
|
+
TranslationLoader5.t(this.stackTrace.message, this.localLanguage),
|
|
900
|
+
"ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH",
|
|
901
|
+
this.stackTrace.name,
|
|
902
|
+
this.stackTrace.stack,
|
|
903
|
+
status4.INTERNAL_SERVER_ERROR
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
traceError(props, name, status7) {
|
|
907
|
+
return new StackTraceError(props, name, status7, true);
|
|
904
908
|
}
|
|
905
909
|
};
|
|
906
910
|
|
|
907
|
-
// src/core/errors/
|
|
908
|
-
import {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
911
|
+
// src/core/errors/internal/internalErrors.ts
|
|
912
|
+
import { LoggerCore as LoggerCore5 } from "opticore-logger";
|
|
913
|
+
import { HttpStatusCode as status5 } from "opticore-http-response";
|
|
914
|
+
import { TranslationLoader as TranslationLoader6 } from "opticore-translator";
|
|
915
|
+
var InternalErrors = class {
|
|
916
|
+
logger = new LoggerCore5();
|
|
917
|
+
stackTrace;
|
|
918
|
+
localLanguage;
|
|
919
|
+
constructor(defaultLocalLang) {
|
|
920
|
+
this.localLanguage = defaultLocalLang;
|
|
921
|
+
}
|
|
922
|
+
errInvalidArgType(error) {
|
|
923
|
+
this.stackTrace = this.traceError(error.message, error.name, status5.INTERNAL_SERVER_ERROR);
|
|
924
|
+
this.logger.error(
|
|
925
|
+
TranslationLoader6.t(this.stackTrace.message, this.localLanguage),
|
|
926
|
+
"ERR_INVALID_ARG_TYPE",
|
|
927
|
+
this.stackTrace.name,
|
|
928
|
+
this.stackTrace.stack,
|
|
929
|
+
status5.INTERNAL_SERVER_ERROR
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
errInvalidCallback(error) {
|
|
933
|
+
this.stackTrace = this.traceError(error.message, error.name, status5.INTERNAL_SERVER_ERROR);
|
|
934
|
+
this.logger.error(
|
|
935
|
+
TranslationLoader6.t(this.stackTrace.message, this.localLanguage),
|
|
936
|
+
"ERR_INVALID_CALLBACK",
|
|
937
|
+
this.stackTrace.name,
|
|
938
|
+
this.stackTrace.stack,
|
|
939
|
+
status5.INTERNAL_SERVER_ERROR
|
|
940
|
+
);
|
|
941
|
+
}
|
|
942
|
+
errHttpHeadersSent(error) {
|
|
943
|
+
this.stackTrace = this.traceError(error.message, error.name, status5.INTERNAL_SERVER_ERROR);
|
|
944
|
+
this.logger.error(
|
|
945
|
+
TranslationLoader6.t(this.stackTrace.message, this.localLanguage),
|
|
946
|
+
"ERR_HTTP_HEADERS_SENT",
|
|
947
|
+
this.stackTrace.name,
|
|
948
|
+
this.stackTrace.stack,
|
|
949
|
+
status5.INTERNAL_SERVER_ERROR
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
errStreamDestroyed(error) {
|
|
953
|
+
this.stackTrace = this.traceError(error.message, error.name, status5.INTERNAL_SERVER_ERROR);
|
|
954
|
+
this.logger.error(
|
|
955
|
+
TranslationLoader6.t(this.stackTrace.message, this.localLanguage),
|
|
956
|
+
"ERR_STREAM_DESTROYED",
|
|
957
|
+
this.stackTrace.name,
|
|
958
|
+
this.stackTrace.stack,
|
|
959
|
+
status5.INTERNAL_SERVER_ERROR
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
errTlsCertAltNameInvalid(error) {
|
|
963
|
+
this.stackTrace = this.traceError(error.message, error.name, status5.INTERNAL_SERVER_ERROR);
|
|
964
|
+
this.logger.error(
|
|
965
|
+
TranslationLoader6.t(this.stackTrace.message, this.localLanguage),
|
|
966
|
+
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
967
|
+
this.stackTrace.name,
|
|
968
|
+
this.stackTrace.stack,
|
|
969
|
+
status5.INTERNAL_SERVER_ERROR
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
errUnsupportedEsmUrlScheme(error) {
|
|
973
|
+
this.stackTrace = this.traceError(error.message, error.name, status5.INTERNAL_SERVER_ERROR);
|
|
974
|
+
this.logger.error(
|
|
975
|
+
TranslationLoader6.t(this.stackTrace.message, this.localLanguage),
|
|
976
|
+
"ERR_UNSUPPORTED_ESM_URL_SCHEME",
|
|
977
|
+
this.stackTrace.name,
|
|
978
|
+
this.stackTrace.stack,
|
|
979
|
+
status5.INTERNAL_SERVER_ERROR
|
|
980
|
+
);
|
|
981
|
+
}
|
|
982
|
+
traceError(props, name, status7) {
|
|
983
|
+
return new StackTraceError(props, name, status7, true);
|
|
912
984
|
}
|
|
913
985
|
};
|
|
914
986
|
|
|
915
|
-
// src/core/errors/
|
|
916
|
-
import {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
987
|
+
// src/core/errors/assertion/assertionErrors.ts
|
|
988
|
+
import { LoggerCore as LoggerCore6 } from "opticore-logger";
|
|
989
|
+
import { HttpStatusCode as status6 } from "opticore-http-response";
|
|
990
|
+
import { TranslationLoader as TranslationLoader7 } from "opticore-translator";
|
|
991
|
+
var AssertionErrors = class {
|
|
992
|
+
logger = new LoggerCore6();
|
|
993
|
+
stackTrace;
|
|
994
|
+
localLanguage;
|
|
995
|
+
constructor(defaultLocalLang) {
|
|
996
|
+
this.localLanguage = defaultLocalLang;
|
|
997
|
+
}
|
|
998
|
+
allError(error) {
|
|
999
|
+
this.stackTrace = this.traceError(error.message, error.name, status6.INTERNAL_SERVER_ERROR);
|
|
1000
|
+
this.logger.error(
|
|
1001
|
+
TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
|
|
1002
|
+
"Error",
|
|
1003
|
+
this.stackTrace.name,
|
|
1004
|
+
this.stackTrace.stack,
|
|
1005
|
+
status6.INTERNAL_SERVER_ERROR
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
evalError(error) {
|
|
1009
|
+
this.stackTrace = this.traceError(error.message, error.name, status6.INTERNAL_SERVER_ERROR);
|
|
1010
|
+
this.logger.error(
|
|
1011
|
+
TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
|
|
1012
|
+
"EvalError",
|
|
1013
|
+
this.stackTrace.name,
|
|
1014
|
+
this.stackTrace.stack,
|
|
1015
|
+
status6.INTERNAL_SERVER_ERROR
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
rangeError(error) {
|
|
1019
|
+
this.stackTrace = this.traceError(error.message, error.name, status6.INTERNAL_SERVER_ERROR);
|
|
1020
|
+
this.logger.error(
|
|
1021
|
+
TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
|
|
1022
|
+
"RangeError",
|
|
1023
|
+
this.stackTrace.name,
|
|
1024
|
+
this.stackTrace.stack,
|
|
1025
|
+
status6.INTERNAL_SERVER_ERROR
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
referenceError(error) {
|
|
1029
|
+
this.stackTrace = this.traceError(error.message, error.name, status6.INTERNAL_SERVER_ERROR);
|
|
1030
|
+
this.logger.error(
|
|
1031
|
+
TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
|
|
1032
|
+
"ReferenceError",
|
|
1033
|
+
this.stackTrace.name,
|
|
1034
|
+
this.stackTrace.stack,
|
|
1035
|
+
status6.INTERNAL_SERVER_ERROR
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
syntaxError(error) {
|
|
1039
|
+
this.stackTrace = this.traceError(error.message, error.name, status6.INTERNAL_SERVER_ERROR);
|
|
1040
|
+
this.logger.error(
|
|
1041
|
+
TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
|
|
1042
|
+
"SyntaxError",
|
|
1043
|
+
this.stackTrace.name,
|
|
1044
|
+
this.stackTrace.stack,
|
|
1045
|
+
status6.INTERNAL_SERVER_ERROR
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1048
|
+
typeError(error) {
|
|
1049
|
+
this.stackTrace = this.traceError(error.message, error.name, status6.INTERNAL_SERVER_ERROR);
|
|
1050
|
+
this.logger.error(
|
|
1051
|
+
TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
|
|
1052
|
+
"TypeError",
|
|
1053
|
+
this.stackTrace.name,
|
|
1054
|
+
this.stackTrace.stack,
|
|
1055
|
+
status6.INTERNAL_SERVER_ERROR
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
uRIError(error) {
|
|
1059
|
+
this.stackTrace = this.traceError(error.message, error.name, status6.INTERNAL_SERVER_ERROR);
|
|
1060
|
+
this.logger.error(
|
|
1061
|
+
TranslationLoader7.t(this.stackTrace.message, this.localLanguage),
|
|
1062
|
+
"URIError",
|
|
1063
|
+
this.stackTrace.name,
|
|
1064
|
+
this.stackTrace.stack,
|
|
1065
|
+
status6.INTERNAL_SERVER_ERROR
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
traceError(props, name, status7) {
|
|
1069
|
+
return new StackTraceError(props, name, status7, true);
|
|
920
1070
|
}
|
|
921
1071
|
};
|
|
922
1072
|
export {
|
|
1073
|
+
AssertionErrors,
|
|
923
1074
|
CErrorName,
|
|
924
1075
|
CEvent,
|
|
925
1076
|
CEventNameError,
|
|
1077
|
+
InternalErrors,
|
|
1078
|
+
JavaScriptErrors,
|
|
1079
|
+
OpenSSLErrors,
|
|
926
1080
|
ServerListenEventError,
|
|
927
|
-
|
|
928
|
-
StackTraceBeforeExit,
|
|
929
|
-
StackTraceEACCES,
|
|
930
|
-
StackTraceEADDRINUSE,
|
|
931
|
-
StackTraceECONNREFUSED,
|
|
932
|
-
StackTraceECONNRESET,
|
|
933
|
-
StackTraceEEXIST,
|
|
934
|
-
StackTraceEISDIR,
|
|
935
|
-
StackTraceEMFILE,
|
|
936
|
-
StackTraceENOENT,
|
|
937
|
-
StackTraceENOTDIR,
|
|
938
|
-
StackTraceENOTEMPTY,
|
|
939
|
-
StackTraceEPERM,
|
|
940
|
-
StackTraceEPIPE,
|
|
941
|
-
StackTraceERR_HTTP_HEADERS_SENT,
|
|
942
|
-
StackTraceERR_INVALID_ARG_TYPE,
|
|
943
|
-
StackTraceERR_INVALID_CALLBACK,
|
|
944
|
-
StackTraceERR_OSSL_BAD_DECRYPT,
|
|
945
|
-
StackTraceERR_OSSL_EVP_UNSUPPORTED,
|
|
946
|
-
StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH,
|
|
947
|
-
StackTraceERR_STREAM_DESTROYED,
|
|
948
|
-
StackTraceERR_TLS_CERT_ALTNAME_INVALID,
|
|
949
|
-
StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME,
|
|
950
|
-
StackTraceETIMEDOUT,
|
|
951
|
-
StackTraceError,
|
|
952
|
-
StackTraceEvalError,
|
|
953
|
-
StackTraceExit,
|
|
954
|
-
StackTraceGeneralError,
|
|
955
|
-
StackTraceOpenSSLError,
|
|
956
|
-
StackTraceRangeError,
|
|
957
|
-
StackTraceReferenceError,
|
|
958
|
-
StackTraceSyntaxError,
|
|
959
|
-
StackTraceSystemError,
|
|
960
|
-
StackTraceTypeError,
|
|
961
|
-
StackTraceURIError,
|
|
962
|
-
StackTraceUncaughtException,
|
|
963
|
-
StackTraceUnhandledRejection
|
|
1081
|
+
SystemErrors
|
|
964
1082
|
};
|