@tsed/exceptions 6.67.0 → 6.69.0-rc.2

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.
Files changed (109) hide show
  1. package/lib/index.js +505 -9
  2. package/lib/index.js.map +1 -1
  3. package/lib/index.modern.js +457 -0
  4. package/lib/index.modern.js.map +1 -0
  5. package/package.json +9 -5
  6. package/lib/clientErrors/BadMapping.js +0 -13
  7. package/lib/clientErrors/BadMapping.js.map +0 -1
  8. package/lib/clientErrors/BadRequest.js +0 -12
  9. package/lib/clientErrors/BadRequest.js.map +0 -1
  10. package/lib/clientErrors/Conflict.js +0 -12
  11. package/lib/clientErrors/Conflict.js.map +0 -1
  12. package/lib/clientErrors/ExpectationFailed.js +0 -12
  13. package/lib/clientErrors/ExpectationFailed.js.map +0 -1
  14. package/lib/clientErrors/Forbidden.js +0 -12
  15. package/lib/clientErrors/Forbidden.js.map +0 -1
  16. package/lib/clientErrors/Gone.js +0 -12
  17. package/lib/clientErrors/Gone.js.map +0 -1
  18. package/lib/clientErrors/ImATeapot.js +0 -13
  19. package/lib/clientErrors/ImATeapot.js.map +0 -1
  20. package/lib/clientErrors/LengthRequired.js +0 -12
  21. package/lib/clientErrors/LengthRequired.js.map +0 -1
  22. package/lib/clientErrors/MethodNotAllowed.js +0 -12
  23. package/lib/clientErrors/MethodNotAllowed.js.map +0 -1
  24. package/lib/clientErrors/MisdirectedRequest.js +0 -12
  25. package/lib/clientErrors/MisdirectedRequest.js.map +0 -1
  26. package/lib/clientErrors/NotAcceptable.js +0 -12
  27. package/lib/clientErrors/NotAcceptable.js.map +0 -1
  28. package/lib/clientErrors/NotFound.js +0 -12
  29. package/lib/clientErrors/NotFound.js.map +0 -1
  30. package/lib/clientErrors/PaymentRequired.js +0 -12
  31. package/lib/clientErrors/PaymentRequired.js.map +0 -1
  32. package/lib/clientErrors/PreconditionFailed.js +0 -12
  33. package/lib/clientErrors/PreconditionFailed.js.map +0 -1
  34. package/lib/clientErrors/PreconditionRequired.js +0 -12
  35. package/lib/clientErrors/PreconditionRequired.js.map +0 -1
  36. package/lib/clientErrors/ProxyAuthentificationRequired.js +0 -12
  37. package/lib/clientErrors/ProxyAuthentificationRequired.js.map +0 -1
  38. package/lib/clientErrors/RequestEntityTooLarge.js +0 -12
  39. package/lib/clientErrors/RequestEntityTooLarge.js.map +0 -1
  40. package/lib/clientErrors/RequestHeaderFieldsTooLarge.js +0 -12
  41. package/lib/clientErrors/RequestHeaderFieldsTooLarge.js.map +0 -1
  42. package/lib/clientErrors/RequestRangeUnsatisfiable.js +0 -12
  43. package/lib/clientErrors/RequestRangeUnsatisfiable.js.map +0 -1
  44. package/lib/clientErrors/RequestTimeout.js +0 -12
  45. package/lib/clientErrors/RequestTimeout.js.map +0 -1
  46. package/lib/clientErrors/RequestURITooLong.js +0 -12
  47. package/lib/clientErrors/RequestURITooLong.js.map +0 -1
  48. package/lib/clientErrors/TooManyRequests.js +0 -12
  49. package/lib/clientErrors/TooManyRequests.js.map +0 -1
  50. package/lib/clientErrors/Unauthorized.js +0 -12
  51. package/lib/clientErrors/Unauthorized.js.map +0 -1
  52. package/lib/clientErrors/UnavailableForLegalReasons.js +0 -12
  53. package/lib/clientErrors/UnavailableForLegalReasons.js.map +0 -1
  54. package/lib/clientErrors/UnprocessableEntity.js +0 -12
  55. package/lib/clientErrors/UnprocessableEntity.js.map +0 -1
  56. package/lib/clientErrors/UnsupportedMediaType.js +0 -12
  57. package/lib/clientErrors/UnsupportedMediaType.js.map +0 -1
  58. package/lib/clientErrors/UpgradeRequired.js +0 -12
  59. package/lib/clientErrors/UpgradeRequired.js.map +0 -1
  60. package/lib/clientErrors/index.js +0 -31
  61. package/lib/clientErrors/index.js.map +0 -1
  62. package/lib/constants/statuses.js +0 -9
  63. package/lib/constants/statuses.js.map +0 -1
  64. package/lib/core/Exception.js +0 -61
  65. package/lib/core/Exception.js.map +0 -1
  66. package/lib/core/index.js +0 -5
  67. package/lib/core/index.js.map +0 -1
  68. package/lib/redirections/MovedPermanently.js +0 -12
  69. package/lib/redirections/MovedPermanently.js.map +0 -1
  70. package/lib/redirections/MovedTemporarily.js +0 -13
  71. package/lib/redirections/MovedTemporarily.js.map +0 -1
  72. package/lib/redirections/MultipleChoices.js +0 -12
  73. package/lib/redirections/MultipleChoices.js.map +0 -1
  74. package/lib/redirections/NotModified.js +0 -12
  75. package/lib/redirections/NotModified.js.map +0 -1
  76. package/lib/redirections/PermanentRedirect.js +0 -12
  77. package/lib/redirections/PermanentRedirect.js.map +0 -1
  78. package/lib/redirections/SeeOther.js +0 -12
  79. package/lib/redirections/SeeOther.js.map +0 -1
  80. package/lib/redirections/TemporaryRedirect.js +0 -12
  81. package/lib/redirections/TemporaryRedirect.js.map +0 -1
  82. package/lib/redirections/TooManyRedirects.js +0 -12
  83. package/lib/redirections/TooManyRedirects.js.map +0 -1
  84. package/lib/redirections/UseProxy.js +0 -12
  85. package/lib/redirections/UseProxy.js.map +0 -1
  86. package/lib/redirections/index.js +0 -13
  87. package/lib/redirections/index.js.map +0 -1
  88. package/lib/serverErrors/BadGateway.js +0 -12
  89. package/lib/serverErrors/BadGateway.js.map +0 -1
  90. package/lib/serverErrors/BandwidthLimitExceeded.js +0 -12
  91. package/lib/serverErrors/BandwidthLimitExceeded.js.map +0 -1
  92. package/lib/serverErrors/GatewayTimeout.js +0 -12
  93. package/lib/serverErrors/GatewayTimeout.js.map +0 -1
  94. package/lib/serverErrors/InternalServerError.js +0 -12
  95. package/lib/serverErrors/InternalServerError.js.map +0 -1
  96. package/lib/serverErrors/NetworkAuthenticationRequired.js +0 -12
  97. package/lib/serverErrors/NetworkAuthenticationRequired.js.map +0 -1
  98. package/lib/serverErrors/NotExtended.js +0 -12
  99. package/lib/serverErrors/NotExtended.js.map +0 -1
  100. package/lib/serverErrors/NotImplemented.js +0 -12
  101. package/lib/serverErrors/NotImplemented.js.map +0 -1
  102. package/lib/serverErrors/ProxyError.js +0 -13
  103. package/lib/serverErrors/ProxyError.js.map +0 -1
  104. package/lib/serverErrors/ServiceUnvailable.js +0 -12
  105. package/lib/serverErrors/ServiceUnvailable.js.map +0 -1
  106. package/lib/serverErrors/VariantAlsoNegotiates.js +0 -12
  107. package/lib/serverErrors/VariantAlsoNegotiates.js.map +0 -1
  108. package/lib/serverErrors/index.js +0 -14
  109. package/lib/serverErrors/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnavailableForLegalReasons.js","sourceRoot":"","sources":["../../src/clientErrors/UnavailableForLegalReasons.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,0BAA2B,SAAQ,qBAAS;IAGvD,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;;AALH,gEAMC;AALiB,iCAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class UnavailableForLegalReasons extends Exception {\n static readonly STATUS = 451;\n\n constructor(message: string, origin?: Error | string | any) {\n super(UnavailableForLegalReasons.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnprocessableEntity = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class UnprocessableEntity extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(UnprocessableEntity.STATUS, message, origin);
8
- }
9
- }
10
- exports.UnprocessableEntity = UnprocessableEntity;
11
- UnprocessableEntity.STATUS = 422;
12
- //# sourceMappingURL=UnprocessableEntity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnprocessableEntity.js","sourceRoot":"","sources":["../../src/clientErrors/UnprocessableEntity.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,mBAAoB,SAAQ,qBAAS;IAGhD,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;;AALH,kDAMC;AALiB,0BAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class UnprocessableEntity extends Exception {\n static readonly STATUS = 422;\n\n constructor(message: string, origin?: Error | string | any) {\n super(UnprocessableEntity.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedMediaType = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class UnsupportedMediaType extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(UnsupportedMediaType.STATUS, message, origin);
8
- }
9
- }
10
- exports.UnsupportedMediaType = UnsupportedMediaType;
11
- UnsupportedMediaType.STATUS = 415;
12
- //# sourceMappingURL=UnsupportedMediaType.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnsupportedMediaType.js","sourceRoot":"","sources":["../../src/clientErrors/UnsupportedMediaType.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,oBAAqB,SAAQ,qBAAS;IAGjD,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;;AALH,oDAMC;AALiB,2BAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class UnsupportedMediaType extends Exception {\n static readonly STATUS = 415;\n\n constructor(message: string, origin?: Error | string | any) {\n super(UnsupportedMediaType.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpgradeRequired = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class UpgradeRequired extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(UpgradeRequired.STATUS, message, origin);
8
- }
9
- }
10
- exports.UpgradeRequired = UpgradeRequired;
11
- UpgradeRequired.STATUS = 426;
12
- //# sourceMappingURL=UpgradeRequired.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UpgradeRequired.js","sourceRoot":"","sources":["../../src/clientErrors/UpgradeRequired.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,eAAgB,SAAQ,qBAAS;IAG5C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;;AALH,0CAMC;AALiB,sBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class UpgradeRequired extends Exception {\n static readonly STATUS = 426;\n\n constructor(message: string, origin?: Error | string | any) {\n super(UpgradeRequired.STATUS, message, origin);\n }\n}\n"]}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./BadMapping"), exports);
5
- tslib_1.__exportStar(require("./BadRequest"), exports);
6
- tslib_1.__exportStar(require("./Conflict"), exports);
7
- tslib_1.__exportStar(require("./ExpectationFailed"), exports);
8
- tslib_1.__exportStar(require("./Forbidden"), exports);
9
- tslib_1.__exportStar(require("./Gone"), exports);
10
- tslib_1.__exportStar(require("./ImATeapot"), exports);
11
- tslib_1.__exportStar(require("./LengthRequired"), exports);
12
- tslib_1.__exportStar(require("./MethodNotAllowed"), exports);
13
- tslib_1.__exportStar(require("./MisdirectedRequest"), exports);
14
- tslib_1.__exportStar(require("./NotAcceptable"), exports);
15
- tslib_1.__exportStar(require("./NotFound"), exports);
16
- tslib_1.__exportStar(require("./PaymentRequired"), exports);
17
- tslib_1.__exportStar(require("./PreconditionFailed"), exports);
18
- tslib_1.__exportStar(require("./PreconditionRequired"), exports);
19
- tslib_1.__exportStar(require("./ProxyAuthentificationRequired"), exports);
20
- tslib_1.__exportStar(require("./RequestRangeUnsatisfiable"), exports);
21
- tslib_1.__exportStar(require("./RequestEntityTooLarge"), exports);
22
- tslib_1.__exportStar(require("./RequestHeaderFieldsTooLarge"), exports);
23
- tslib_1.__exportStar(require("./RequestTimeout"), exports);
24
- tslib_1.__exportStar(require("./RequestURITooLong"), exports);
25
- tslib_1.__exportStar(require("./TooManyRequests"), exports);
26
- tslib_1.__exportStar(require("./Unauthorized"), exports);
27
- tslib_1.__exportStar(require("./UnsupportedMediaType"), exports);
28
- tslib_1.__exportStar(require("./UpgradeRequired"), exports);
29
- tslib_1.__exportStar(require("./UnavailableForLegalReasons"), exports);
30
- tslib_1.__exportStar(require("./UnprocessableEntity"), exports);
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clientErrors/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,uDAA6B;AAC7B,qDAA2B;AAC3B,8DAAoC;AACpC,sDAA4B;AAC5B,iDAAuB;AACvB,sDAA4B;AAC5B,2DAAiC;AACjC,6DAAmC;AACnC,+DAAqC;AACrC,0DAAgC;AAChC,qDAA2B;AAC3B,4DAAkC;AAClC,+DAAqC;AACrC,iEAAuC;AACvC,0EAAgD;AAChD,sEAA4C;AAC5C,kEAAwC;AACxC,wEAA8C;AAC9C,2DAAiC;AACjC,8DAAoC;AACpC,4DAAkC;AAClC,yDAA+B;AAC/B,iEAAuC;AACvC,4DAAkC;AAClC,uEAA6C;AAC7C,gEAAsC","sourcesContent":["export * from \"./BadMapping\";\nexport * from \"./BadRequest\";\nexport * from \"./Conflict\";\nexport * from \"./ExpectationFailed\";\nexport * from \"./Forbidden\";\nexport * from \"./Gone\";\nexport * from \"./ImATeapot\";\nexport * from \"./LengthRequired\";\nexport * from \"./MethodNotAllowed\";\nexport * from \"./MisdirectedRequest\";\nexport * from \"./NotAcceptable\";\nexport * from \"./NotFound\";\nexport * from \"./PaymentRequired\";\nexport * from \"./PreconditionFailed\";\nexport * from \"./PreconditionRequired\";\nexport * from \"./ProxyAuthentificationRequired\";\nexport * from \"./RequestRangeUnsatisfiable\";\nexport * from \"./RequestEntityTooLarge\";\nexport * from \"./RequestHeaderFieldsTooLarge\";\nexport * from \"./RequestTimeout\";\nexport * from \"./RequestURITooLong\";\nexport * from \"./TooManyRequests\";\nexport * from \"./Unauthorized\";\nexport * from \"./UnsupportedMediaType\";\nexport * from \"./UpgradeRequired\";\nexport * from \"./UnavailableForLegalReasons\";\nexport * from \"./UnprocessableEntity\";\n"]}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HTTP_STATUSES = void 0;
4
- const schema_1 = require("@tsed/schema");
5
- /**
6
- *
7
- */
8
- exports.HTTP_STATUSES = schema_1.HTTP_STATUS_MESSAGES;
9
- //# sourceMappingURL=statuses.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"statuses.js","sourceRoot":"","sources":["../../src/constants/statuses.ts"],"names":[],"mappings":";;;AAAA,yCAAkD;AAElD;;GAEG;AACU,QAAA,aAAa,GAAQ,6BAAoB,CAAC","sourcesContent":["import {HTTP_STATUS_MESSAGES} from \"@tsed/schema\";\n\n/**\n *\n */\nexport const HTTP_STATUSES: any = HTTP_STATUS_MESSAGES;\n"]}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HTTPException = exports.Exception = void 0;
4
- const schema_1 = require("@tsed/schema");
5
- class Exception extends Error {
6
- constructor(status = 500, message = "", origin) {
7
- super(message);
8
- /**
9
- * Exception base name
10
- * @type {string}
11
- */
12
- this.name = "HTTP_EXCEPTION";
13
- /**
14
- * Exception type
15
- * @type {string}
16
- */
17
- this.type = "HTTP_EXCEPTION";
18
- /**
19
- * Headers must be sent to the response
20
- */
21
- this.headers = {};
22
- this.status = status;
23
- this.message = message;
24
- this.name = schema_1.getStatusConstant(status);
25
- this.setOrigin(origin);
26
- }
27
- setHeaders(headers) {
28
- this.headers = {
29
- ...this.headers,
30
- ...headers
31
- };
32
- return this;
33
- }
34
- setHeader(key, value) {
35
- this.headers[key] = value;
36
- return this;
37
- }
38
- setOrigin(origin) {
39
- if (origin) {
40
- if (origin instanceof Error) {
41
- this.origin = origin;
42
- this.message = `${this.message}, innerException: ${this.origin.message}`.trim();
43
- }
44
- else if (typeof origin === "string") {
45
- this.origin = new Error(origin);
46
- this.message = `${this.message}, innerException: ${this.origin.message}`.trim();
47
- }
48
- else {
49
- this.body = origin;
50
- }
51
- }
52
- }
53
- toString() {
54
- return `${this.name}(${this.status}): ${this.message} `.trim();
55
- }
56
- }
57
- exports.Exception = Exception;
58
- class HTTPException extends Exception {
59
- }
60
- exports.HTTPException = HTTPException;
61
- //# sourceMappingURL=Exception.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../src/core/Exception.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAE/C,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;;WAEG;QACI,YAAO,GAAyB,EAAE,CAAC;QAOxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,0BAAiB,CAAC,MAAM,CAAC,CAAC;QAEtC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,UAAU,CAAC,OAA6B;QACtC,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,OAAO;SACX,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,GAAW,EAAE,KAAU;QAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAE1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,MAA4B;QACpC,IAAI,MAAM,EAAE;YACV,IAAI,MAAM,YAAY,KAAK,EAAE;gBAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;gBACrB,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,qBAAqB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC;aACjF;iBAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBACrC,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;gBAChC,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,qBAAqB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC;aACjF;iBAAM;gBACL,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;aACpB;SACF;IACH,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACjE,CAAC;CACF;AA7ED,8BA6EC;AAED,MAAa,aAAc,SAAQ,SAAS;CAAG;AAA/C,sCAA+C","sourcesContent":["import {getStatusConstant} from \"@tsed/schema\";\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/core/index.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Exception"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B","sourcesContent":["export * from \"./Exception\";\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MovedPermanently = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class MovedPermanently extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(MovedPermanently.STATUS, message, origin);
8
- }
9
- }
10
- exports.MovedPermanently = MovedPermanently;
11
- MovedPermanently.STATUS = 301;
12
- //# sourceMappingURL=MovedPermanently.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MovedPermanently.js","sourceRoot":"","sources":["../../src/redirections/MovedPermanently.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,gBAAiB,SAAQ,qBAAS;IAG7C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;;AALH,4CAMC;AALiB,uBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class MovedPermanently extends Exception {\n static readonly STATUS = 301;\n\n constructor(message: string, origin?: Error | string | any) {\n super(MovedPermanently.STATUS, message, origin);\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MovedTemporarily = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class MovedTemporarily extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(MovedTemporarily.STATUS, message, origin);
8
- this.name = "MOVED_TEMPORARILY";
9
- }
10
- }
11
- exports.MovedTemporarily = MovedTemporarily;
12
- MovedTemporarily.STATUS = 302;
13
- //# sourceMappingURL=MovedTemporarily.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MovedTemporarily.js","sourceRoot":"","sources":["../../src/redirections/MovedTemporarily.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,gBAAiB,SAAQ,qBAAS;IAI7C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAHlD,SAAI,GAAW,mBAAmB,CAAC;IAInC,CAAC;;AANH,4CAOC;AANiB,uBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class MovedTemporarily extends Exception {\n static readonly STATUS = 302;\n name: string = \"MOVED_TEMPORARILY\";\n\n constructor(message: string, origin?: Error | string | any) {\n super(MovedTemporarily.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MultipleChoices = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class MultipleChoices extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(MultipleChoices.STATUS, message, origin);
8
- }
9
- }
10
- exports.MultipleChoices = MultipleChoices;
11
- MultipleChoices.STATUS = 300;
12
- //# sourceMappingURL=MultipleChoices.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MultipleChoices.js","sourceRoot":"","sources":["../../src/redirections/MultipleChoices.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,eAAgB,SAAQ,qBAAS;IAG5C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;;AALH,0CAMC;AALiB,sBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class MultipleChoices extends Exception {\n static readonly STATUS = 300;\n\n constructor(message: string, origin?: Error | string | any) {\n super(MultipleChoices.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotModified = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class NotModified extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(NotModified.STATUS, message, origin);
8
- }
9
- }
10
- exports.NotModified = NotModified;
11
- NotModified.STATUS = 304;
12
- //# sourceMappingURL=NotModified.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotModified.js","sourceRoot":"","sources":["../../src/redirections/NotModified.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,WAAY,SAAQ,qBAAS;IAGxC,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;;AALH,kCAMC;AALiB,kBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class NotModified extends Exception {\n static readonly STATUS = 304;\n\n constructor(message: string, origin?: Error | string | any) {\n super(NotModified.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PermanentRedirect = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class PermanentRedirect extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(PermanentRedirect.STATUS, message, origin);
8
- }
9
- }
10
- exports.PermanentRedirect = PermanentRedirect;
11
- PermanentRedirect.STATUS = 308;
12
- //# sourceMappingURL=PermanentRedirect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PermanentRedirect.js","sourceRoot":"","sources":["../../src/redirections/PermanentRedirect.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,iBAAkB,SAAQ,qBAAS;IAG9C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;;AALH,8CAMC;AALiB,wBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class PermanentRedirect extends Exception {\n static readonly STATUS = 308;\n\n constructor(message: string, origin?: Error | string | any) {\n super(PermanentRedirect.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SeeOther = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class SeeOther extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(SeeOther.STATUS, message, origin);
8
- }
9
- }
10
- exports.SeeOther = SeeOther;
11
- SeeOther.STATUS = 303;
12
- //# sourceMappingURL=SeeOther.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SeeOther.js","sourceRoot":"","sources":["../../src/redirections/SeeOther.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,QAAS,SAAQ,qBAAS;IAGrC,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;;AALH,4BAMC;AALiB,eAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class SeeOther extends Exception {\n static readonly STATUS = 303;\n\n constructor(message: string, origin?: Error | string | any) {\n super(SeeOther.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TemporaryRedirect = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class TemporaryRedirect extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(TemporaryRedirect.STATUS, message, origin);
8
- }
9
- }
10
- exports.TemporaryRedirect = TemporaryRedirect;
11
- TemporaryRedirect.STATUS = 307;
12
- //# sourceMappingURL=TemporaryRedirect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemporaryRedirect.js","sourceRoot":"","sources":["../../src/redirections/TemporaryRedirect.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,iBAAkB,SAAQ,qBAAS;IAG9C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;;AALH,8CAMC;AALiB,wBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class TemporaryRedirect extends Exception {\n static readonly STATUS = 307;\n\n constructor(message: string, origin?: Error | string | any) {\n super(TemporaryRedirect.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TooManyRedirects = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class TooManyRedirects extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(TooManyRedirects.STATUS, message, origin);
8
- }
9
- }
10
- exports.TooManyRedirects = TooManyRedirects;
11
- TooManyRedirects.STATUS = 310;
12
- //# sourceMappingURL=TooManyRedirects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TooManyRedirects.js","sourceRoot":"","sources":["../../src/redirections/TooManyRedirects.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,gBAAiB,SAAQ,qBAAS;IAG7C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;;AALH,4CAMC;AALiB,uBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class TooManyRedirects extends Exception {\n static readonly STATUS = 310;\n\n constructor(message: string, origin?: Error | string | any) {\n super(TooManyRedirects.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UseProxy = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class UseProxy extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(UseProxy.STATUS, message, origin);
8
- }
9
- }
10
- exports.UseProxy = UseProxy;
11
- UseProxy.STATUS = 305;
12
- //# sourceMappingURL=UseProxy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UseProxy.js","sourceRoot":"","sources":["../../src/redirections/UseProxy.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,QAAS,SAAQ,qBAAS;IAGrC,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;;AALH,4BAMC;AALiB,eAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class UseProxy extends Exception {\n static readonly STATUS = 305;\n\n constructor(message: string, origin?: Error | string | any) {\n super(UseProxy.STATUS, message, origin);\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./MovedPermanently"), exports);
5
- tslib_1.__exportStar(require("./MovedTemporarily"), exports);
6
- tslib_1.__exportStar(require("./MultipleChoices"), exports);
7
- tslib_1.__exportStar(require("./NotModified"), exports);
8
- tslib_1.__exportStar(require("./PermanentRedirect"), exports);
9
- tslib_1.__exportStar(require("./SeeOther"), exports);
10
- tslib_1.__exportStar(require("./TemporaryRedirect"), exports);
11
- tslib_1.__exportStar(require("./TooManyRedirects"), exports);
12
- tslib_1.__exportStar(require("./UseProxy"), exports);
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/redirections/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,6DAAmC;AACnC,4DAAkC;AAClC,wDAA8B;AAC9B,8DAAoC;AACpC,qDAA2B;AAC3B,8DAAoC;AACpC,6DAAmC;AACnC,qDAA2B","sourcesContent":["export * from \"./MovedPermanently\";\nexport * from \"./MovedTemporarily\";\nexport * from \"./MultipleChoices\";\nexport * from \"./NotModified\";\nexport * from \"./PermanentRedirect\";\nexport * from \"./SeeOther\";\nexport * from \"./TemporaryRedirect\";\nexport * from \"./TooManyRedirects\";\nexport * from \"./UseProxy\";\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BadGateway = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class BadGateway extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(BadGateway.STATUS, message, origin);
8
- }
9
- }
10
- exports.BadGateway = BadGateway;
11
- BadGateway.STATUS = 502;
12
- //# sourceMappingURL=BadGateway.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BadGateway.js","sourceRoot":"","sources":["../../src/serverErrors/BadGateway.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,UAAW,SAAQ,qBAAS;IAGvC,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;;AALH,gCAMC;AALiB,iBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class BadGateway extends Exception {\n static readonly STATUS = 502;\n\n constructor(message: string, origin?: Error | string | any) {\n super(BadGateway.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BandwidthLimitExceeded = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class BandwidthLimitExceeded extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(BandwidthLimitExceeded.STATUS, message, origin);
8
- }
9
- }
10
- exports.BandwidthLimitExceeded = BandwidthLimitExceeded;
11
- BandwidthLimitExceeded.STATUS = 509;
12
- //# sourceMappingURL=BandwidthLimitExceeded.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BandwidthLimitExceeded.js","sourceRoot":"","sources":["../../src/serverErrors/BandwidthLimitExceeded.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,sBAAuB,SAAQ,qBAAS;IAGnD,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;;AALH,wDAMC;AALiB,6BAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class BandwidthLimitExceeded extends Exception {\n static readonly STATUS = 509;\n\n constructor(message: string, origin?: Error | string | any) {\n super(BandwidthLimitExceeded.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GatewayTimeout = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class GatewayTimeout extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(GatewayTimeout.STATUS, message, origin);
8
- }
9
- }
10
- exports.GatewayTimeout = GatewayTimeout;
11
- GatewayTimeout.STATUS = 504;
12
- //# sourceMappingURL=GatewayTimeout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GatewayTimeout.js","sourceRoot":"","sources":["../../src/serverErrors/GatewayTimeout.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,cAAe,SAAQ,qBAAS;IAG3C,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;;AALH,wCAMC;AALiB,qBAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class GatewayTimeout extends Exception {\n static readonly STATUS = 504;\n\n constructor(message: string, origin?: Error | string | any) {\n super(GatewayTimeout.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InternalServerError = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class InternalServerError extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(InternalServerError.STATUS, message, origin);
8
- }
9
- }
10
- exports.InternalServerError = InternalServerError;
11
- InternalServerError.STATUS = 500;
12
- //# sourceMappingURL=InternalServerError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InternalServerError.js","sourceRoot":"","sources":["../../src/serverErrors/InternalServerError.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,mBAAoB,SAAQ,qBAAS;IAGhD,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;;AALH,kDAMC;AALiB,0BAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class InternalServerError extends Exception {\n static readonly STATUS = 500;\n\n constructor(message: string, origin?: Error | string | any) {\n super(InternalServerError.STATUS, message, origin);\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NetworkAuthenticationRequired = void 0;
4
- const Exception_1 = require("../core/Exception");
5
- class NetworkAuthenticationRequired extends Exception_1.Exception {
6
- constructor(message, origin) {
7
- super(NetworkAuthenticationRequired.STATUS, message, origin);
8
- }
9
- }
10
- exports.NetworkAuthenticationRequired = NetworkAuthenticationRequired;
11
- NetworkAuthenticationRequired.STATUS = 511;
12
- //# sourceMappingURL=NetworkAuthenticationRequired.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NetworkAuthenticationRequired.js","sourceRoot":"","sources":["../../src/serverErrors/NetworkAuthenticationRequired.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,6BAA8B,SAAQ,qBAAS;IAG1D,YAAY,OAAe,EAAE,MAA6B;QACxD,KAAK,CAAC,6BAA6B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;;AALH,sEAMC;AALiB,oCAAM,GAAG,GAAG,CAAC","sourcesContent":["import {Exception} from \"../core/Exception\";\n\nexport class NetworkAuthenticationRequired extends Exception {\n static readonly STATUS = 511;\n\n constructor(message: string, origin?: Error | string | any) {\n super(NetworkAuthenticationRequired.STATUS, message, origin);\n }\n}\n"]}