opticore-catch-exception-error 1.0.0
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 +196 -0
- package/dist/index.d.cts +128 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.js +156 -0
- package/package.json +37 -0
- package/tsconfig.json +26 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
CErrorName: () => CErrorName,
|
|
24
|
+
CEvent: () => CEvent,
|
|
25
|
+
CEventNameError: () => CEventNameError,
|
|
26
|
+
StackTraceAssertionError: () => StackTraceAssertionError,
|
|
27
|
+
StackTraceError: () => StackTraceError,
|
|
28
|
+
StackTraceEvalError: () => StackTraceEvalError,
|
|
29
|
+
StackTraceGeneralError: () => StackTraceGeneralError,
|
|
30
|
+
StackTraceOpenSSLError: () => StackTraceOpenSSLError,
|
|
31
|
+
StackTraceRangeError: () => StackTraceRangeError,
|
|
32
|
+
StackTraceReferenceError: () => StackTraceReferenceError,
|
|
33
|
+
StackTraceSyntaxError: () => StackTraceSyntaxError,
|
|
34
|
+
StackTraceSystemError: () => StackTraceSystemError,
|
|
35
|
+
StackTraceTypeError: () => StackTraceTypeError,
|
|
36
|
+
StackTraceURIError: () => StackTraceURIError
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
|
+
|
|
40
|
+
// src/domains/constants/errorName.constant.ts
|
|
41
|
+
var CErrorName = {
|
|
42
|
+
evalError: "EvalError",
|
|
43
|
+
syntaxError: "SyntaxError",
|
|
44
|
+
rangeError: "RangeError",
|
|
45
|
+
referenceError: "ReferenceError",
|
|
46
|
+
typeError: "TypeError",
|
|
47
|
+
uriError: "URIError",
|
|
48
|
+
systemError: "SystemError",
|
|
49
|
+
assertionError: "AssertionError",
|
|
50
|
+
openSSLError: "OpenSSLError",
|
|
51
|
+
generalError: "GeneralError"
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/domains/constants/event.constant.ts
|
|
55
|
+
var CEvent = {
|
|
56
|
+
beforeExit: "beforeExit",
|
|
57
|
+
disconnect: "disconnect",
|
|
58
|
+
exit: "exit",
|
|
59
|
+
rejectionHandled: "rejectionHandled",
|
|
60
|
+
uncaughtException: "uncaughtException",
|
|
61
|
+
uncaughtExceptionMonitor: "uncaughtExceptionMonitor",
|
|
62
|
+
unhandledRejection: "unhandledRejection",
|
|
63
|
+
warning: "warning",
|
|
64
|
+
message: "message",
|
|
65
|
+
multipleResolves: "multipleResolves",
|
|
66
|
+
worker: "worker",
|
|
67
|
+
sigint: "SIGINT",
|
|
68
|
+
sigterm: "SIGTERM"
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/domains/constants/eventNameError.constant.ts
|
|
72
|
+
var CEventNameError = {
|
|
73
|
+
error: "error",
|
|
74
|
+
listening: "listening",
|
|
75
|
+
close: "close",
|
|
76
|
+
connection: "connection",
|
|
77
|
+
drop: "drop",
|
|
78
|
+
request: "request"
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/core/errors/base/stackTraceError.ts
|
|
82
|
+
var StackTraceError = class extends Error {
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param props
|
|
86
|
+
* @param name
|
|
87
|
+
* @param httpCode
|
|
88
|
+
* @param isOperational
|
|
89
|
+
*/
|
|
90
|
+
constructor(props, name, httpCode, isOperational) {
|
|
91
|
+
super(props);
|
|
92
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
93
|
+
this.name = name;
|
|
94
|
+
this.httpCode = httpCode;
|
|
95
|
+
this.isOperational = isOperational;
|
|
96
|
+
Error.captureStackTrace(this);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// src/core/errors/stackTraceAssertionError.ts
|
|
101
|
+
var import_opticore_http_response = require("opticore-http-response");
|
|
102
|
+
var StackTraceAssertionError = class extends StackTraceError {
|
|
103
|
+
constructor(message) {
|
|
104
|
+
super(message, CErrorName.evalError, import_opticore_http_response.HttpStatusCode.INTERNAL_SERVER_ERROR, true);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// src/core/errors/stackTraceEvalError.ts
|
|
109
|
+
var import_opticore_http_response2 = require("opticore-http-response");
|
|
110
|
+
var StackTraceEvalError = class extends StackTraceError {
|
|
111
|
+
constructor(message) {
|
|
112
|
+
super(message, CErrorName.evalError, import_opticore_http_response2.HttpStatusCode.BAD_REQUEST, true);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/core/errors/stackTraceGeneralError.ts
|
|
117
|
+
var import_opticore_http_response3 = require("opticore-http-response");
|
|
118
|
+
var StackTraceGeneralError = class extends StackTraceError {
|
|
119
|
+
constructor(message) {
|
|
120
|
+
super(message, CErrorName.evalError, import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR, false);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/core/errors/stackTraceOpenSSLError.ts
|
|
125
|
+
var import_opticore_http_response4 = require("opticore-http-response");
|
|
126
|
+
var StackTraceOpenSSLError = class extends StackTraceError {
|
|
127
|
+
constructor(message) {
|
|
128
|
+
super(message, CErrorName.evalError, import_opticore_http_response4.HttpStatusCode.INTERNAL_SERVER_ERROR, false);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/core/errors/stackTraceRangeError.ts
|
|
133
|
+
var import_opticore_http_response5 = require("opticore-http-response");
|
|
134
|
+
var StackTraceRangeError = class extends StackTraceError {
|
|
135
|
+
constructor(message) {
|
|
136
|
+
super(message, CErrorName.evalError, import_opticore_http_response5.HttpStatusCode.BAD_REQUEST, true);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// src/core/errors/stackTraceReferenceError.ts
|
|
141
|
+
var import_opticore_http_response6 = require("opticore-http-response");
|
|
142
|
+
var StackTraceReferenceError = class extends StackTraceError {
|
|
143
|
+
constructor(message) {
|
|
144
|
+
super(message, CErrorName.evalError, import_opticore_http_response6.HttpStatusCode.BAD_REQUEST, true);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/core/errors/stackTraceSyntaxError.ts
|
|
149
|
+
var import_opticore_http_response7 = require("opticore-http-response");
|
|
150
|
+
var StackTraceSyntaxError = class extends StackTraceError {
|
|
151
|
+
constructor(message) {
|
|
152
|
+
super(message, CErrorName.evalError, import_opticore_http_response7.HttpStatusCode.BAD_REQUEST, true);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// src/core/errors/stackTraceSystemError.ts
|
|
157
|
+
var import_opticore_http_response8 = require("opticore-http-response");
|
|
158
|
+
var StackTraceSystemError = class extends StackTraceError {
|
|
159
|
+
constructor(message, code) {
|
|
160
|
+
super(message, CErrorName.systemError, import_opticore_http_response8.HttpStatusCode.INTERNAL_SERVER_ERROR, false);
|
|
161
|
+
this.message = `${message} (code: ${code})`;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// src/core/errors/stackTraceTypeError.ts
|
|
166
|
+
var import_opticore_http_response9 = require("opticore-http-response");
|
|
167
|
+
var StackTraceTypeError = class extends StackTraceError {
|
|
168
|
+
constructor(message) {
|
|
169
|
+
super(message, CErrorName.evalError, import_opticore_http_response9.HttpStatusCode.BAD_REQUEST, true);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/core/errors/stackTraceURIError.ts
|
|
174
|
+
var import_opticore_http_response10 = require("opticore-http-response");
|
|
175
|
+
var StackTraceURIError = class extends StackTraceError {
|
|
176
|
+
constructor(message) {
|
|
177
|
+
super(message, CErrorName.evalError, import_opticore_http_response10.HttpStatusCode.BAD_REQUEST, true);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
+
0 && (module.exports = {
|
|
182
|
+
CErrorName,
|
|
183
|
+
CEvent,
|
|
184
|
+
CEventNameError,
|
|
185
|
+
StackTraceAssertionError,
|
|
186
|
+
StackTraceError,
|
|
187
|
+
StackTraceEvalError,
|
|
188
|
+
StackTraceGeneralError,
|
|
189
|
+
StackTraceOpenSSLError,
|
|
190
|
+
StackTraceRangeError,
|
|
191
|
+
StackTraceReferenceError,
|
|
192
|
+
StackTraceSyntaxError,
|
|
193
|
+
StackTraceSystemError,
|
|
194
|
+
StackTraceTypeError,
|
|
195
|
+
StackTraceURIError
|
|
196
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { HttpStatusCode } from 'opticore-http-response';
|
|
2
|
+
|
|
3
|
+
declare const CErrorName: {
|
|
4
|
+
evalError: string;
|
|
5
|
+
syntaxError: string;
|
|
6
|
+
rangeError: string;
|
|
7
|
+
referenceError: string;
|
|
8
|
+
typeError: string;
|
|
9
|
+
uriError: string;
|
|
10
|
+
systemError: string;
|
|
11
|
+
assertionError: string;
|
|
12
|
+
openSSLError: string;
|
|
13
|
+
generalError: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const CEvent: {
|
|
17
|
+
beforeExit: string;
|
|
18
|
+
disconnect: string;
|
|
19
|
+
exit: string;
|
|
20
|
+
rejectionHandled: string;
|
|
21
|
+
uncaughtException: string;
|
|
22
|
+
uncaughtExceptionMonitor: string;
|
|
23
|
+
unhandledRejection: string;
|
|
24
|
+
warning: string;
|
|
25
|
+
message: string;
|
|
26
|
+
multipleResolves: string;
|
|
27
|
+
worker: string;
|
|
28
|
+
sigint: string;
|
|
29
|
+
sigterm: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
declare const CEventNameError: {
|
|
33
|
+
error: string;
|
|
34
|
+
listening: string;
|
|
35
|
+
close: string;
|
|
36
|
+
connection: string;
|
|
37
|
+
drop: string;
|
|
38
|
+
request: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Handling and catch a Node.js error.
|
|
43
|
+
*/
|
|
44
|
+
declare class StackTraceError extends Error {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly httpCode: HttpStatusCode | any;
|
|
47
|
+
readonly isOperational: boolean;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param props
|
|
51
|
+
* @param name
|
|
52
|
+
* @param httpCode
|
|
53
|
+
* @param isOperational
|
|
54
|
+
*/
|
|
55
|
+
constructor(props: string | undefined, name: string, httpCode: HttpStatusCode | any, isOperational: boolean);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Handling and catch a Node.js error.
|
|
60
|
+
*/
|
|
61
|
+
declare class StackTraceAssertionError extends StackTraceError {
|
|
62
|
+
constructor(message: string);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Handling and catch a Node.js error.
|
|
67
|
+
*/
|
|
68
|
+
declare class StackTraceEvalError extends StackTraceError {
|
|
69
|
+
constructor(message: string);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Handling and catch a Node.js error.
|
|
74
|
+
*/
|
|
75
|
+
declare class StackTraceGeneralError extends StackTraceError {
|
|
76
|
+
constructor(message: string);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Handling and catch a Node.js error.
|
|
81
|
+
*/
|
|
82
|
+
declare class StackTraceOpenSSLError extends StackTraceError {
|
|
83
|
+
constructor(message: string);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Handling and catch a Node.js error.
|
|
88
|
+
*/
|
|
89
|
+
declare class StackTraceRangeError extends StackTraceError {
|
|
90
|
+
constructor(message: string);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Handling and catch a Node.js error.
|
|
95
|
+
*/
|
|
96
|
+
declare class StackTraceReferenceError extends StackTraceError {
|
|
97
|
+
constructor(message: string);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Handling and catch a Node.js error.
|
|
102
|
+
*/
|
|
103
|
+
declare class StackTraceSyntaxError extends StackTraceError {
|
|
104
|
+
constructor(message: string);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Handling and catch a Node.js error.
|
|
109
|
+
*/
|
|
110
|
+
declare class StackTraceSystemError extends StackTraceError {
|
|
111
|
+
constructor(message: string, code: string);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Handling and catch a Node.js error.
|
|
116
|
+
*/
|
|
117
|
+
declare class StackTraceTypeError extends StackTraceError {
|
|
118
|
+
constructor(message: string);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Handling and catch a Node.js error.
|
|
123
|
+
*/
|
|
124
|
+
declare class StackTraceURIError extends StackTraceError {
|
|
125
|
+
constructor(message: string);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { CErrorName, CEvent, CEventNameError, StackTraceAssertionError, StackTraceError, StackTraceEvalError, StackTraceGeneralError, StackTraceOpenSSLError, StackTraceRangeError, StackTraceReferenceError, StackTraceSyntaxError, StackTraceSystemError, StackTraceTypeError, StackTraceURIError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { HttpStatusCode } from 'opticore-http-response';
|
|
2
|
+
|
|
3
|
+
declare const CErrorName: {
|
|
4
|
+
evalError: string;
|
|
5
|
+
syntaxError: string;
|
|
6
|
+
rangeError: string;
|
|
7
|
+
referenceError: string;
|
|
8
|
+
typeError: string;
|
|
9
|
+
uriError: string;
|
|
10
|
+
systemError: string;
|
|
11
|
+
assertionError: string;
|
|
12
|
+
openSSLError: string;
|
|
13
|
+
generalError: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const CEvent: {
|
|
17
|
+
beforeExit: string;
|
|
18
|
+
disconnect: string;
|
|
19
|
+
exit: string;
|
|
20
|
+
rejectionHandled: string;
|
|
21
|
+
uncaughtException: string;
|
|
22
|
+
uncaughtExceptionMonitor: string;
|
|
23
|
+
unhandledRejection: string;
|
|
24
|
+
warning: string;
|
|
25
|
+
message: string;
|
|
26
|
+
multipleResolves: string;
|
|
27
|
+
worker: string;
|
|
28
|
+
sigint: string;
|
|
29
|
+
sigterm: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
declare const CEventNameError: {
|
|
33
|
+
error: string;
|
|
34
|
+
listening: string;
|
|
35
|
+
close: string;
|
|
36
|
+
connection: string;
|
|
37
|
+
drop: string;
|
|
38
|
+
request: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Handling and catch a Node.js error.
|
|
43
|
+
*/
|
|
44
|
+
declare class StackTraceError extends Error {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly httpCode: HttpStatusCode | any;
|
|
47
|
+
readonly isOperational: boolean;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param props
|
|
51
|
+
* @param name
|
|
52
|
+
* @param httpCode
|
|
53
|
+
* @param isOperational
|
|
54
|
+
*/
|
|
55
|
+
constructor(props: string | undefined, name: string, httpCode: HttpStatusCode | any, isOperational: boolean);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Handling and catch a Node.js error.
|
|
60
|
+
*/
|
|
61
|
+
declare class StackTraceAssertionError extends StackTraceError {
|
|
62
|
+
constructor(message: string);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Handling and catch a Node.js error.
|
|
67
|
+
*/
|
|
68
|
+
declare class StackTraceEvalError extends StackTraceError {
|
|
69
|
+
constructor(message: string);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Handling and catch a Node.js error.
|
|
74
|
+
*/
|
|
75
|
+
declare class StackTraceGeneralError extends StackTraceError {
|
|
76
|
+
constructor(message: string);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Handling and catch a Node.js error.
|
|
81
|
+
*/
|
|
82
|
+
declare class StackTraceOpenSSLError extends StackTraceError {
|
|
83
|
+
constructor(message: string);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Handling and catch a Node.js error.
|
|
88
|
+
*/
|
|
89
|
+
declare class StackTraceRangeError extends StackTraceError {
|
|
90
|
+
constructor(message: string);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Handling and catch a Node.js error.
|
|
95
|
+
*/
|
|
96
|
+
declare class StackTraceReferenceError extends StackTraceError {
|
|
97
|
+
constructor(message: string);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Handling and catch a Node.js error.
|
|
102
|
+
*/
|
|
103
|
+
declare class StackTraceSyntaxError extends StackTraceError {
|
|
104
|
+
constructor(message: string);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Handling and catch a Node.js error.
|
|
109
|
+
*/
|
|
110
|
+
declare class StackTraceSystemError extends StackTraceError {
|
|
111
|
+
constructor(message: string, code: string);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Handling and catch a Node.js error.
|
|
116
|
+
*/
|
|
117
|
+
declare class StackTraceTypeError extends StackTraceError {
|
|
118
|
+
constructor(message: string);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Handling and catch a Node.js error.
|
|
123
|
+
*/
|
|
124
|
+
declare class StackTraceURIError extends StackTraceError {
|
|
125
|
+
constructor(message: string);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { CErrorName, CEvent, CEventNameError, StackTraceAssertionError, StackTraceError, StackTraceEvalError, StackTraceGeneralError, StackTraceOpenSSLError, StackTraceRangeError, StackTraceReferenceError, StackTraceSyntaxError, StackTraceSystemError, StackTraceTypeError, StackTraceURIError };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// src/domains/constants/errorName.constant.ts
|
|
2
|
+
var CErrorName = {
|
|
3
|
+
evalError: "EvalError",
|
|
4
|
+
syntaxError: "SyntaxError",
|
|
5
|
+
rangeError: "RangeError",
|
|
6
|
+
referenceError: "ReferenceError",
|
|
7
|
+
typeError: "TypeError",
|
|
8
|
+
uriError: "URIError",
|
|
9
|
+
systemError: "SystemError",
|
|
10
|
+
assertionError: "AssertionError",
|
|
11
|
+
openSSLError: "OpenSSLError",
|
|
12
|
+
generalError: "GeneralError"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/domains/constants/event.constant.ts
|
|
16
|
+
var CEvent = {
|
|
17
|
+
beforeExit: "beforeExit",
|
|
18
|
+
disconnect: "disconnect",
|
|
19
|
+
exit: "exit",
|
|
20
|
+
rejectionHandled: "rejectionHandled",
|
|
21
|
+
uncaughtException: "uncaughtException",
|
|
22
|
+
uncaughtExceptionMonitor: "uncaughtExceptionMonitor",
|
|
23
|
+
unhandledRejection: "unhandledRejection",
|
|
24
|
+
warning: "warning",
|
|
25
|
+
message: "message",
|
|
26
|
+
multipleResolves: "multipleResolves",
|
|
27
|
+
worker: "worker",
|
|
28
|
+
sigint: "SIGINT",
|
|
29
|
+
sigterm: "SIGTERM"
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// src/domains/constants/eventNameError.constant.ts
|
|
33
|
+
var CEventNameError = {
|
|
34
|
+
error: "error",
|
|
35
|
+
listening: "listening",
|
|
36
|
+
close: "close",
|
|
37
|
+
connection: "connection",
|
|
38
|
+
drop: "drop",
|
|
39
|
+
request: "request"
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// src/core/errors/base/stackTraceError.ts
|
|
43
|
+
var StackTraceError = class extends Error {
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param props
|
|
47
|
+
* @param name
|
|
48
|
+
* @param httpCode
|
|
49
|
+
* @param isOperational
|
|
50
|
+
*/
|
|
51
|
+
constructor(props, name, httpCode, isOperational) {
|
|
52
|
+
super(props);
|
|
53
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
54
|
+
this.name = name;
|
|
55
|
+
this.httpCode = httpCode;
|
|
56
|
+
this.isOperational = isOperational;
|
|
57
|
+
Error.captureStackTrace(this);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/core/errors/stackTraceAssertionError.ts
|
|
62
|
+
import { HttpStatusCode as status } from "opticore-http-response";
|
|
63
|
+
var StackTraceAssertionError = class extends StackTraceError {
|
|
64
|
+
constructor(message) {
|
|
65
|
+
super(message, CErrorName.evalError, status.INTERNAL_SERVER_ERROR, true);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/core/errors/stackTraceEvalError.ts
|
|
70
|
+
import { HttpStatusCode as status2 } from "opticore-http-response";
|
|
71
|
+
var StackTraceEvalError = class extends StackTraceError {
|
|
72
|
+
constructor(message) {
|
|
73
|
+
super(message, CErrorName.evalError, status2.BAD_REQUEST, true);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/core/errors/stackTraceGeneralError.ts
|
|
78
|
+
import { HttpStatusCode as status3 } from "opticore-http-response";
|
|
79
|
+
var StackTraceGeneralError = class extends StackTraceError {
|
|
80
|
+
constructor(message) {
|
|
81
|
+
super(message, CErrorName.evalError, status3.INTERNAL_SERVER_ERROR, false);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/core/errors/stackTraceOpenSSLError.ts
|
|
86
|
+
import { HttpStatusCode as status4 } from "opticore-http-response";
|
|
87
|
+
var StackTraceOpenSSLError = class extends StackTraceError {
|
|
88
|
+
constructor(message) {
|
|
89
|
+
super(message, CErrorName.evalError, status4.INTERNAL_SERVER_ERROR, false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/core/errors/stackTraceRangeError.ts
|
|
94
|
+
import { HttpStatusCode as status5 } from "opticore-http-response";
|
|
95
|
+
var StackTraceRangeError = class extends StackTraceError {
|
|
96
|
+
constructor(message) {
|
|
97
|
+
super(message, CErrorName.evalError, status5.BAD_REQUEST, true);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/core/errors/stackTraceReferenceError.ts
|
|
102
|
+
import { HttpStatusCode as status6 } from "opticore-http-response";
|
|
103
|
+
var StackTraceReferenceError = class extends StackTraceError {
|
|
104
|
+
constructor(message) {
|
|
105
|
+
super(message, CErrorName.evalError, status6.BAD_REQUEST, true);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/core/errors/stackTraceSyntaxError.ts
|
|
110
|
+
import { HttpStatusCode as status7 } from "opticore-http-response";
|
|
111
|
+
var StackTraceSyntaxError = class extends StackTraceError {
|
|
112
|
+
constructor(message) {
|
|
113
|
+
super(message, CErrorName.evalError, status7.BAD_REQUEST, true);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/core/errors/stackTraceSystemError.ts
|
|
118
|
+
import { HttpStatusCode as status8 } from "opticore-http-response";
|
|
119
|
+
var StackTraceSystemError = class extends StackTraceError {
|
|
120
|
+
constructor(message, code) {
|
|
121
|
+
super(message, CErrorName.systemError, status8.INTERNAL_SERVER_ERROR, false);
|
|
122
|
+
this.message = `${message} (code: ${code})`;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/core/errors/stackTraceTypeError.ts
|
|
127
|
+
import { HttpStatusCode as status9 } from "opticore-http-response";
|
|
128
|
+
var StackTraceTypeError = class extends StackTraceError {
|
|
129
|
+
constructor(message) {
|
|
130
|
+
super(message, CErrorName.evalError, status9.BAD_REQUEST, true);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/core/errors/stackTraceURIError.ts
|
|
135
|
+
import { HttpStatusCode as status10 } from "opticore-http-response";
|
|
136
|
+
var StackTraceURIError = class extends StackTraceError {
|
|
137
|
+
constructor(message) {
|
|
138
|
+
super(message, CErrorName.evalError, status10.BAD_REQUEST, true);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
export {
|
|
142
|
+
CErrorName,
|
|
143
|
+
CEvent,
|
|
144
|
+
CEventNameError,
|
|
145
|
+
StackTraceAssertionError,
|
|
146
|
+
StackTraceError,
|
|
147
|
+
StackTraceEvalError,
|
|
148
|
+
StackTraceGeneralError,
|
|
149
|
+
StackTraceOpenSSLError,
|
|
150
|
+
StackTraceRangeError,
|
|
151
|
+
StackTraceReferenceError,
|
|
152
|
+
StackTraceSyntaxError,
|
|
153
|
+
StackTraceSystemError,
|
|
154
|
+
StackTraceTypeError,
|
|
155
|
+
StackTraceURIError
|
|
156
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opticore-catch-exception-error",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "opticore catch exception error",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"build": "tsup"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/guyzoum77/opticore-catch-exception-error.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"opticore",
|
|
19
|
+
"opticore-catch-exception-error"
|
|
20
|
+
],
|
|
21
|
+
"author": "Guy-serge Kouacou",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/guyzoum77/opticore-catch-exception-error/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/guyzoum77/opticore-catch-exception-error#readme",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"opticore-http-response": "^1.0.3"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.13.5",
|
|
32
|
+
"reflect-metadata": "^0.2.2",
|
|
33
|
+
"tslib": "^2.8.1",
|
|
34
|
+
"typescript": "^5.4.5",
|
|
35
|
+
"tsup": "^8.4.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"noImplicitAny": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"strictNullChecks": true,
|
|
7
|
+
"module": "commonjs",
|
|
8
|
+
"pretty": true,
|
|
9
|
+
"target": "es2017",
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"noEmit": false,
|
|
14
|
+
"types": ["reflect-metadata", "node"],
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"outDir": "./dist",
|
|
17
|
+
"importHelpers": true,
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"baseUrl": "src",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@opticoreStackError/*": ["*"],
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*.ts", "src/**/*.json", ".env"],
|
|
25
|
+
"exclude": ["node_modules"]
|
|
26
|
+
}
|