cursor-ai-fork 0.0.1-security → 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.

Potentially problematic release.


This version of cursor-ai-fork might be problematic. Click here for more details.

package/lib/errors.js ADDED
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
+
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10
+
11
+ exports.BaseError = function (_Error) {
12
+ _inherits(BaseError, _Error);
13
+
14
+ /**
15
+ * @class BaseError
16
+ * @constructor
17
+ * @private
18
+ * @param {String} code Error code
19
+ * @param {String} message Error message
20
+ */
21
+ function BaseError(code, message) {
22
+ _classCallCheck(this, BaseError);
23
+
24
+ var _this = _possibleConstructorReturn(this, (BaseError.__proto__ || Object.getPrototypeOf(BaseError)).call(this, code + ': ' + message));
25
+
26
+ _this.code = code;
27
+ return _this;
28
+ }
29
+
30
+ _createClass(BaseError, [{
31
+ key: 'toJSON',
32
+ value: function toJSON() {
33
+ return {
34
+ code: this.code,
35
+ message: this.message
36
+ };
37
+ }
38
+ }]);
39
+
40
+ return BaseError;
41
+ }(Error);
42
+
43
+ exports.FatalError = function (_exports$BaseError) {
44
+ _inherits(FatalError, _exports$BaseError);
45
+
46
+ /**
47
+ * Fatal Error. Error code is `"EFATAL"`.
48
+ * @class FatalError
49
+ * @constructor
50
+ * @param {String|Error} data Error object or message
51
+ */
52
+ function FatalError(data) {
53
+ _classCallCheck(this, FatalError);
54
+
55
+ var error = typeof data === 'string' ? null : data;
56
+ var message = error ? error.message : data;
57
+
58
+ var _this2 = _possibleConstructorReturn(this, (FatalError.__proto__ || Object.getPrototypeOf(FatalError)).call(this, 'EFATAL', message));
59
+
60
+ if (error) {
61
+ _this2.stack = error.stack;
62
+ _this2.cause = error;
63
+ }
64
+ return _this2;
65
+ }
66
+
67
+ return FatalError;
68
+ }(exports.BaseError);
69
+
70
+ exports.ParseError = function (_exports$BaseError2) {
71
+ _inherits(ParseError, _exports$BaseError2);
72
+
73
+ /**
74
+ * Error during parsing. Error code is `"EPARSE"`.
75
+ * @class ParseError
76
+ * @constructor
77
+ * @param {String} message Error message
78
+ * @param {http.IncomingMessage} response Server response
79
+ */
80
+ function ParseError(message, response) {
81
+ _classCallCheck(this, ParseError);
82
+
83
+ var _this3 = _possibleConstructorReturn(this, (ParseError.__proto__ || Object.getPrototypeOf(ParseError)).call(this, 'EPARSE', message));
84
+
85
+ _this3.response = response;
86
+ return _this3;
87
+ }
88
+
89
+ return ParseError;
90
+ }(exports.BaseError);
91
+
92
+ exports.TelegramError = function (_exports$BaseError3) {
93
+ _inherits(TelegramError, _exports$BaseError3);
94
+
95
+ /**
96
+ * Error returned from Telegram. Error code is `"ETELEGRAM"`.
97
+ * @class TelegramError
98
+ * @constructor
99
+ * @param {String} message Error message
100
+ * @param {http.IncomingMessage} response Server response
101
+ */
102
+ function TelegramError(message, response) {
103
+ _classCallCheck(this, TelegramError);
104
+
105
+ var _this4 = _possibleConstructorReturn(this, (TelegramError.__proto__ || Object.getPrototypeOf(TelegramError)).call(this, 'ETELEGRAM', message));
106
+
107
+ _this4.response = response;
108
+ return _this4;
109
+ }
110
+
111
+ return TelegramError;
112
+ }(exports.BaseError);