opticore-catch-exception-error 1.0.15 → 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 +479 -392
- package/dist/index.d.cts +67 -261
- package/dist/index.d.ts +67 -261
- package/dist/index.js +474 -355
- 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
|
/**
|
|
@@ -643,14 +562,14 @@ var ServerListenEventError = class {
|
|
|
643
562
|
this.stackTrace = this.traceError(
|
|
644
563
|
TranslationLoader2.t("processPIDReceivedSignal", this.localeLanguage, { signal: signal.toString() }),
|
|
645
564
|
"SIGTERM",
|
|
646
|
-
|
|
565
|
+
status.NOT_ACCEPTABLE
|
|
647
566
|
);
|
|
648
567
|
this.logger.error(
|
|
649
568
|
this.stackTrace.message,
|
|
650
569
|
"SIGTERM",
|
|
651
570
|
this.stackTrace.name,
|
|
652
571
|
this.stackTrace.stack,
|
|
653
|
-
|
|
572
|
+
status.NOT_ACCEPTABLE
|
|
654
573
|
);
|
|
655
574
|
process.exit(0);
|
|
656
575
|
}
|
|
@@ -687,277 +606,477 @@ var ServerListenEventError = class {
|
|
|
687
606
|
"response status",
|
|
688
607
|
TranslationLoader2.t("respndNotFunc", this.localeLanguage, { err }),
|
|
689
608
|
err.stack,
|
|
690
|
-
|
|
609
|
+
status.NOT_ACCEPTABLE
|
|
691
610
|
);
|
|
692
611
|
}
|
|
693
612
|
this.stackTrace = this.traceError(
|
|
694
613
|
err.message,
|
|
695
614
|
TranslationLoader2.t("expressError", this.localeLanguage, { err }),
|
|
696
|
-
|
|
615
|
+
status.NOT_ACCEPTABLE
|
|
697
616
|
);
|
|
698
617
|
this.logger.error(
|
|
699
618
|
this.stackTrace.message,
|
|
700
619
|
TranslationLoader2.t("expressErrorHandlingMiddleware", this.localeLanguage, { err }),
|
|
701
620
|
this.stackTrace.name,
|
|
702
621
|
this.stackTrace.stack,
|
|
703
|
-
|
|
622
|
+
status.SERVICE_UNAVAILABLE
|
|
704
623
|
);
|
|
705
624
|
} else {
|
|
706
625
|
next();
|
|
707
626
|
}
|
|
708
627
|
}
|
|
709
|
-
traceError(props, name,
|
|
710
|
-
return new StackTraceError(props, name,
|
|
628
|
+
traceError(props, name, status7) {
|
|
629
|
+
return new StackTraceError(props, name, status7, true);
|
|
711
630
|
}
|
|
712
631
|
};
|
|
713
632
|
|
|
714
|
-
// src/core/errors/
|
|
715
|
-
import {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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;
|
|
719
643
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
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
|
+
);
|
|
727
653
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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
|
+
);
|
|
735
663
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
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
|
+
);
|
|
743
673
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
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
|
+
);
|
|
751
683
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
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
|
+
);
|
|
759
693
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
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
|
+
);
|
|
767
703
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
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
|
+
);
|
|
775
713
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
// src/core/errors/stackTraceENOTDIR.ts
|
|
779
|
-
import { HttpStatusCode as status20 } from "opticore-http-response";
|
|
780
|
-
var StackTraceENOTDIR = class extends StackTraceError {
|
|
781
|
-
constructor(message) {
|
|
782
|
-
super(message, CErrorName.enotdir, status20.INTERNAL_SERVER_ERROR, true);
|
|
714
|
+
traceError(props, name, status7) {
|
|
715
|
+
return new StackTraceError(props, name, status7, true);
|
|
783
716
|
}
|
|
784
717
|
};
|
|
785
718
|
|
|
786
|
-
// src/core/errors/
|
|
787
|
-
import {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
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;
|
|
791
729
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
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
|
+
);
|
|
799
739
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
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
|
+
);
|
|
807
749
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
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
|
+
);
|
|
815
759
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
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
|
+
);
|
|
823
769
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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
|
+
);
|
|
831
779
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
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
|
+
);
|
|
839
789
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
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
|
+
);
|
|
847
799
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
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
|
+
);
|
|
855
809
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
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
|
+
);
|
|
863
819
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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
|
+
);
|
|
871
829
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
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
|
+
);
|
|
879
839
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
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
|
+
);
|
|
887
849
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
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);
|
|
895
862
|
}
|
|
896
863
|
};
|
|
897
864
|
|
|
898
|
-
// src/core/errors/
|
|
899
|
-
import {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
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);
|
|
903
908
|
}
|
|
904
909
|
};
|
|
905
910
|
|
|
906
|
-
// src/core/errors/
|
|
907
|
-
import {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
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);
|
|
911
984
|
}
|
|
912
985
|
};
|
|
913
986
|
|
|
914
|
-
// src/core/errors/
|
|
915
|
-
import {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
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);
|
|
919
1070
|
}
|
|
920
1071
|
};
|
|
921
1072
|
export {
|
|
1073
|
+
AssertionErrors,
|
|
922
1074
|
CErrorName,
|
|
923
1075
|
CEvent,
|
|
924
1076
|
CEventNameError,
|
|
1077
|
+
InternalErrors,
|
|
1078
|
+
JavaScriptErrors,
|
|
1079
|
+
OpenSSLErrors,
|
|
925
1080
|
ServerListenEventError,
|
|
926
|
-
|
|
927
|
-
StackTraceBeforeExit,
|
|
928
|
-
StackTraceEACCES,
|
|
929
|
-
StackTraceEADDRINUSE,
|
|
930
|
-
StackTraceECONNREFUSED,
|
|
931
|
-
StackTraceECONNRESET,
|
|
932
|
-
StackTraceEEXIST,
|
|
933
|
-
StackTraceEISDIR,
|
|
934
|
-
StackTraceEMFILE,
|
|
935
|
-
StackTraceENOENT,
|
|
936
|
-
StackTraceENOTDIR,
|
|
937
|
-
StackTraceENOTEMPTY,
|
|
938
|
-
StackTraceEPERM,
|
|
939
|
-
StackTraceEPIPE,
|
|
940
|
-
StackTraceERR_HTTP_HEADERS_SENT,
|
|
941
|
-
StackTraceERR_INVALID_ARG_TYPE,
|
|
942
|
-
StackTraceERR_INVALID_CALLBACK,
|
|
943
|
-
StackTraceERR_OSSL_BAD_DECRYPT,
|
|
944
|
-
StackTraceERR_OSSL_EVP_UNSUPPORTED,
|
|
945
|
-
StackTraceERR_OSSL_WRONG_FINAL_BLOCK_LENGTH,
|
|
946
|
-
StackTraceERR_STREAM_DESTROYED,
|
|
947
|
-
StackTraceERR_TLS_CERT_ALTNAME_INVALID,
|
|
948
|
-
StackTraceERR_UNSUPPORTED_ESM_URL_SCHEME,
|
|
949
|
-
StackTraceETIMEDOUT,
|
|
950
|
-
StackTraceError,
|
|
951
|
-
StackTraceEvalError,
|
|
952
|
-
StackTraceExit,
|
|
953
|
-
StackTraceGeneralError,
|
|
954
|
-
StackTraceOpenSSLError,
|
|
955
|
-
StackTraceRangeError,
|
|
956
|
-
StackTraceReferenceError,
|
|
957
|
-
StackTraceSyntaxError,
|
|
958
|
-
StackTraceSystemError,
|
|
959
|
-
StackTraceTypeError,
|
|
960
|
-
StackTraceURIError,
|
|
961
|
-
StackTraceUncaughtException,
|
|
962
|
-
StackTraceUnhandledRejection
|
|
1081
|
+
SystemErrors
|
|
963
1082
|
};
|