-
Notifications
You must be signed in to change notification settings - Fork 238
/
Copy pathnode-fetch+2.7.0.patch
48 lines (43 loc) · 1.4 KB
/
node-fetch+2.7.0.patch
1
2
3
4
5
6
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
diff --git a/node_modules/node-fetch/lib/index.js b/node_modules/node-fetch/lib/index.js
index 567ff5d..f1e1684 100644
--- a/node_modules/node-fetch/lib/index.js
+++ b/node_modules/node-fetch/lib/index.js
@@ -1,3 +1,4 @@
+// @ts-nocheck
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
@@ -154,9 +155,23 @@ function FetchError(message, type, systemError) {
Error.captureStackTrace(this, this.constructor);
}
-FetchError.prototype = Object.create(Error.prototype);
-FetchError.prototype.constructor = FetchError;
-FetchError.prototype.name = 'FetchError';
+function makeErrorish(errorConstructor, name) {
+ errorConstructor.prototype = Object.create(Error.prototype, {
+ constructor: {
+ value: errorConstructor,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ },
+ name: {
+ value: name,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ },
+ });
+}
+makeErrorish(FetchError, 'FetchError');
let convert;
try {
@@ -1396,10 +1411,7 @@ function AbortError(message) {
// hide custom error implementation details from end-users
Error.captureStackTrace(this, this.constructor);
}
-
-AbortError.prototype = Object.create(Error.prototype);
-AbortError.prototype.constructor = AbortError;
-AbortError.prototype.name = 'AbortError';
+makeErrorish(AbortError, 'AbortError');
const URL$1 = Url.URL || whatwgUrl.URL;