@tsed/exceptions 6.107.3 → 6.108.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/lib/cjs/core/Exception.js +1 -1
- package/lib/cjs/core/Exception.js.map +1 -1
- package/lib/cjs/index.js +46 -46
- package/lib/cjs/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HTTPException = exports.Exception = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const change_case_1 = require("change-case");
|
|
6
|
-
const statuses_1 =
|
|
6
|
+
const statuses_1 = tslib_1.__importDefault(require("statuses"));
|
|
7
7
|
function getStatusConstant(status) {
|
|
8
8
|
return status === 200 ? "SUCCESS" : (0, change_case_1.constantCase)(String((0, statuses_1.default)(status)));
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/core/Exception.ts"],"names":[],"mappings":";;;;AAAA,6CAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/core/Exception.ts"],"names":[],"mappings":";;;;AAAA,6CAAyC;AACzC,gEAAgC;AAEhC,SAAS,iBAAiB,CAAC,MAAc;IACvC,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,0BAAY,EAAC,MAAM,CAAC,IAAA,kBAAQ,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,MAAa,SAAU,SAAQ,KAAK;IAmClC,YAAY,SAAiB,GAAG,EAAE,UAAkB,EAAE,EAAE,MAA6B;QACnF,KAAK,CAAC,OAAO,CAAC,CAAC;QAnCjB;;;WAGG;QACI,SAAI,GAAW,gBAAgB,CAAC;QAKvC;;;WAGG;QACI,SAAI,GAAW,gBAAgB,CAAC;QAcvC;;WA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;AA7ED,8BA6EC;AAED,MAAa,aAAc,SAAQ,SAAS;CAAG;AAA/C,sCAA+C","sourcesContent":["import {constantCase} from \"change-case\";\nimport statuses from \"statuses\";\n\nfunction getStatusConstant(status: number) {\n return status === 200 ? \"SUCCESS\" : constantCase(String(statuses(status)));\n}\n\nexport class Exception extends Error {\n /**\n * Exception base name\n * @type {string}\n */\n public name: string = \"HTTP_EXCEPTION\";\n /**\n * Message of the exception\n */\n public message: string;\n /**\n * Exception type\n * @type {string}\n */\n public type: string = \"HTTP_EXCEPTION\";\n /**\n * Stack calling\n */\n public stack: string;\n public origin: Error & any;\n /**\n * HTTP Code Status\n */\n public status: number;\n /**\n *\n */\n public body: any;\n /**\n * Headers must be sent to the response\n */\n public headers: {[key: string]: any} = {};\n\n [key: string]: any;\n\n constructor(status: number = 500, message: string = \"\", origin?: Error | string | any) {\n super(message);\n\n this.status = status;\n this.message = message;\n this.name = getStatusConstant(status);\n\n this.setOrigin(origin);\n }\n\n setHeaders(headers: {[key: string]: any}) {\n this.headers = {\n ...this.headers,\n ...headers\n };\n\n return this;\n }\n\n setHeader(key: string, value: any) {\n this.headers[key] = value;\n\n return this;\n }\n\n setOrigin(origin: Error | string | any) {\n if (origin) {\n if (origin instanceof Error) {\n this.origin = origin;\n this.message = `${this.message}, innerException: ${this.origin.message}`.trim();\n } else if (typeof origin === \"string\") {\n this.origin = new Error(origin);\n this.message = `${this.message}, innerException: ${this.origin.message}`.trim();\n } else {\n this.body = origin;\n }\n }\n }\n\n toString() {\n return `${this.name}(${this.status}): ${this.message} `.trim();\n }\n}\n\nexport class HTTPException extends Exception {}\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,50 +4,50 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
7
|
+
tslib_1.__exportStar(require("./clientErrors/BadMapping"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./clientErrors/BadRequest"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./clientErrors/Conflict"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./clientErrors/ExpectationFailed"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./clientErrors/Forbidden"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./clientErrors/Gone"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./clientErrors/ImATeapot"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./clientErrors/LengthRequired"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./clientErrors/MethodNotAllowed"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./clientErrors/MisdirectedRequest"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./clientErrors/NotAcceptable"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./clientErrors/NotFound"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./clientErrors/PaymentRequired"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./clientErrors/PreconditionFailed"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./clientErrors/PreconditionRequired"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./clientErrors/ProxyAuthentificationRequired"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./clientErrors/RequestEntityTooLarge"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./clientErrors/RequestHeaderFieldsTooLarge"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./clientErrors/RequestRangeUnsatisfiable"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./clientErrors/RequestTimeout"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./clientErrors/RequestURITooLong"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./clientErrors/TooManyRequests"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./clientErrors/Unauthorized"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./clientErrors/UnavailableForLegalReasons"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./clientErrors/UnprocessableEntity"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./clientErrors/UnsupportedMediaType"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./clientErrors/UpgradeRequired"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./core/Exception"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./redirections/MovedPermanently"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./redirections/MovedTemporarily"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./redirections/MultipleChoices"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./redirections/NotModified"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./redirections/PermanentRedirect"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./redirections/SeeOther"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./redirections/TemporaryRedirect"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./redirections/UseProxy"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./serverErrors/BadGateway"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./serverErrors/BandwidthLimitExceeded"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./serverErrors/GatewayTimeout"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./serverErrors/InternalServerError"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./serverErrors/NetworkAuthenticationRequired"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./serverErrors/NotExtended"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./serverErrors/NotImplemented"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./serverErrors/ProxyError"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./serverErrors/ServiceUnvailable"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./serverErrors/VariantAlsoNegotiates"), exports);
|
|
53
53
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oEAA0C;AAC1C,oEAA0C;AAC1C,kEAAwC;AACxC,2EAAiD;AACjD,mEAAyC;AACzC,8DAAoC;AACpC,mEAAyC;AACzC,wEAA8C;AAC9C,0EAAgD;AAChD,4EAAkD;AAClD,uEAA6C;AAC7C,kEAAwC;AACxC,yEAA+C;AAC/C,4EAAkD;AAClD,8EAAoD;AACpD,uFAA6D;AAC7D,+EAAqD;AACrD,qFAA2D;AAC3D,mFAAyD;AACzD,wEAA8C;AAC9C,2EAAiD;AACjD,yEAA+C;AAC/C,sEAA4C;AAC5C,oFAA0D;AAC1D,6EAAmD;AACnD,8EAAoD;AACpD,yEAA+C;AAC/C,2DAAiC;AACjC,0EAAgD;AAChD,0EAAgD;AAChD,yEAA+C;AAC/C,qEAA2C;AAC3C,2EAAiD;AACjD,kEAAwC;AACxC,2EAAiD;AACjD,kEAAwC;AACxC,oEAA0C;AAC1C,gFAAsD;AACtD,wEAA8C;AAC9C,6EAAmD;AACnD,uFAA6D;AAC7D,qEAA2C;AAC3C,wEAA8C;AAC9C,oEAA0C;AAC1C,2EAAiD;AACjD,+EAAqD","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./clientErrors/BadMapping\";\nexport * from \"./clientErrors/BadRequest\";\nexport * from \"./clientErrors/Conflict\";\nexport * from \"./clientErrors/ExpectationFailed\";\nexport * from \"./clientErrors/Forbidden\";\nexport * from \"./clientErrors/Gone\";\nexport * from \"./clientErrors/ImATeapot\";\nexport * from \"./clientErrors/LengthRequired\";\nexport * from \"./clientErrors/MethodNotAllowed\";\nexport * from \"./clientErrors/MisdirectedRequest\";\nexport * from \"./clientErrors/NotAcceptable\";\nexport * from \"./clientErrors/NotFound\";\nexport * from \"./clientErrors/PaymentRequired\";\nexport * from \"./clientErrors/PreconditionFailed\";\nexport * from \"./clientErrors/PreconditionRequired\";\nexport * from \"./clientErrors/ProxyAuthentificationRequired\";\nexport * from \"./clientErrors/RequestEntityTooLarge\";\nexport * from \"./clientErrors/RequestHeaderFieldsTooLarge\";\nexport * from \"./clientErrors/RequestRangeUnsatisfiable\";\nexport * from \"./clientErrors/RequestTimeout\";\nexport * from \"./clientErrors/RequestURITooLong\";\nexport * from \"./clientErrors/TooManyRequests\";\nexport * from \"./clientErrors/Unauthorized\";\nexport * from \"./clientErrors/UnavailableForLegalReasons\";\nexport * from \"./clientErrors/UnprocessableEntity\";\nexport * from \"./clientErrors/UnsupportedMediaType\";\nexport * from \"./clientErrors/UpgradeRequired\";\nexport * from \"./core/Exception\";\nexport * from \"./redirections/MovedPermanently\";\nexport * from \"./redirections/MovedTemporarily\";\nexport * from \"./redirections/MultipleChoices\";\nexport * from \"./redirections/NotModified\";\nexport * from \"./redirections/PermanentRedirect\";\nexport * from \"./redirections/SeeOther\";\nexport * from \"./redirections/TemporaryRedirect\";\nexport * from \"./redirections/UseProxy\";\nexport * from \"./serverErrors/BadGateway\";\nexport * from \"./serverErrors/BandwidthLimitExceeded\";\nexport * from \"./serverErrors/GatewayTimeout\";\nexport * from \"./serverErrors/InternalServerError\";\nexport * from \"./serverErrors/NetworkAuthenticationRequired\";\nexport * from \"./serverErrors/NotExtended\";\nexport * from \"./serverErrors/NotImplemented\";\nexport * from \"./serverErrors/ProxyError\";\nexport * from \"./serverErrors/ServiceUnvailable\";\nexport * from \"./serverErrors/VariantAlsoNegotiates\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/exceptions",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.108.0",
|
|
4
4
|
"description": "HTTP exceptions module for Ts.ED Framework and other pure Express application",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"change-case": "4.1.2",
|
|
24
24
|
"statuses": ">=2.0.1",
|
|
25
|
-
"tslib": "2.
|
|
25
|
+
"tslib": "2.3.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/statuses": "2.0.0"
|