@anabranch/fs 0.2.1 → 0.2.3
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/esm/errors.js +13 -78
- package/package.json +2 -1
package/esm/errors.js
CHANGED
|
@@ -15,142 +15,77 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export class FSError extends Error {
|
|
18
|
+
kind;
|
|
19
|
+
path;
|
|
18
20
|
constructor(kind, path, message) {
|
|
19
21
|
super(message);
|
|
20
|
-
Object.defineProperty(this, "kind", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: void 0
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "path", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: void 0
|
|
31
|
-
});
|
|
32
22
|
this.kind = kind;
|
|
33
23
|
this.path = path;
|
|
34
24
|
}
|
|
35
25
|
}
|
|
36
26
|
export class NotFound extends FSError {
|
|
27
|
+
name = 'NotFound';
|
|
37
28
|
constructor(path, message) {
|
|
38
29
|
super('NotFound', path, message);
|
|
39
|
-
Object.defineProperty(this, "name", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: 'NotFound'
|
|
44
|
-
});
|
|
45
30
|
}
|
|
46
31
|
}
|
|
47
32
|
/** File already exists when it should not. */
|
|
48
33
|
export class AlreadyExists extends FSError {
|
|
34
|
+
name = 'AlreadyExists';
|
|
49
35
|
constructor(path, message) {
|
|
50
36
|
super('AlreadyExists', path, message);
|
|
51
|
-
Object.defineProperty(this, "name", {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
configurable: true,
|
|
54
|
-
writable: true,
|
|
55
|
-
value: 'AlreadyExists'
|
|
56
|
-
});
|
|
57
37
|
}
|
|
58
38
|
}
|
|
59
39
|
/** Path is a directory when a file was expected. */
|
|
60
40
|
export class IsDirectory extends FSError {
|
|
41
|
+
name = 'IsDirectory';
|
|
61
42
|
constructor(path, message) {
|
|
62
43
|
super('IsDirectory', path, message);
|
|
63
|
-
Object.defineProperty(this, "name", {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
configurable: true,
|
|
66
|
-
writable: true,
|
|
67
|
-
value: 'IsDirectory'
|
|
68
|
-
});
|
|
69
44
|
}
|
|
70
45
|
}
|
|
71
46
|
/** Path is not a directory when a directory was expected. */
|
|
72
47
|
export class NotDirectory extends FSError {
|
|
48
|
+
name = 'NotDirectory';
|
|
73
49
|
constructor(path, message) {
|
|
74
50
|
super('NotDirectory', path, message);
|
|
75
|
-
Object.defineProperty(this, "name", {
|
|
76
|
-
enumerable: true,
|
|
77
|
-
configurable: true,
|
|
78
|
-
writable: true,
|
|
79
|
-
value: 'NotDirectory'
|
|
80
|
-
});
|
|
81
51
|
}
|
|
82
52
|
}
|
|
83
53
|
/** Permission denied accessing the file system. */
|
|
84
54
|
export class PermissionDenied extends FSError {
|
|
55
|
+
name = 'PermissionDenied';
|
|
85
56
|
constructor(path, message) {
|
|
86
57
|
super('PermissionDenied', path, message);
|
|
87
|
-
Object.defineProperty(this, "name", {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
configurable: true,
|
|
90
|
-
writable: true,
|
|
91
|
-
value: 'PermissionDenied'
|
|
92
|
-
});
|
|
93
58
|
}
|
|
94
59
|
}
|
|
95
60
|
/** Error reading from the file system. */
|
|
96
61
|
export class ReadError extends FSError {
|
|
62
|
+
name = 'ReadError';
|
|
97
63
|
constructor(path, message) {
|
|
98
64
|
super('ReadError', path, message);
|
|
99
|
-
Object.defineProperty(this, "name", {
|
|
100
|
-
enumerable: true,
|
|
101
|
-
configurable: true,
|
|
102
|
-
writable: true,
|
|
103
|
-
value: 'ReadError'
|
|
104
|
-
});
|
|
105
65
|
}
|
|
106
66
|
}
|
|
107
67
|
/** Error writing to the file system. */
|
|
108
68
|
export class WriteError extends FSError {
|
|
69
|
+
name = 'WriteError';
|
|
109
70
|
constructor(path, message) {
|
|
110
71
|
super('WriteError', path, message);
|
|
111
|
-
Object.defineProperty(this, "name", {
|
|
112
|
-
enumerable: true,
|
|
113
|
-
configurable: true,
|
|
114
|
-
writable: true,
|
|
115
|
-
value: 'WriteError'
|
|
116
|
-
});
|
|
117
72
|
}
|
|
118
73
|
}
|
|
119
74
|
/** File content is invalid (e.g., malformed JSON). */
|
|
120
75
|
export class InvalidData extends FSError {
|
|
76
|
+
cause;
|
|
77
|
+
name = 'InvalidData';
|
|
121
78
|
constructor(path, message, cause) {
|
|
122
79
|
super('InvalidData', path, message);
|
|
123
|
-
Object.defineProperty(this, "cause", {
|
|
124
|
-
enumerable: true,
|
|
125
|
-
configurable: true,
|
|
126
|
-
writable: true,
|
|
127
|
-
value: void 0
|
|
128
|
-
});
|
|
129
|
-
Object.defineProperty(this, "name", {
|
|
130
|
-
enumerable: true,
|
|
131
|
-
configurable: true,
|
|
132
|
-
writable: true,
|
|
133
|
-
value: 'InvalidData'
|
|
134
|
-
});
|
|
135
80
|
this.cause = cause;
|
|
136
81
|
}
|
|
137
82
|
}
|
|
138
83
|
/** Unknown file system error. */
|
|
139
84
|
export class Unknown extends FSError {
|
|
85
|
+
cause;
|
|
86
|
+
name = 'Unknown';
|
|
140
87
|
constructor(path, message, cause) {
|
|
141
88
|
super('Unknown', path, message);
|
|
142
|
-
Object.defineProperty(this, "cause", {
|
|
143
|
-
enumerable: true,
|
|
144
|
-
configurable: true,
|
|
145
|
-
writable: true,
|
|
146
|
-
value: void 0
|
|
147
|
-
});
|
|
148
|
-
Object.defineProperty(this, "name", {
|
|
149
|
-
enumerable: true,
|
|
150
|
-
configurable: true,
|
|
151
|
-
writable: true,
|
|
152
|
-
value: 'Unknown'
|
|
153
|
-
});
|
|
154
89
|
this.cause = cause;
|
|
155
90
|
}
|
|
156
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anabranch/fs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Streaming file-system utilities for reading, walking, globbing, and watching files with composable error handling.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"scripts": {},
|
|
20
|
+
"sideEffects": false,
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"anabranch": "^0"
|
|
22
23
|
},
|