@zenfs/core 0.7.11 → 0.8.1
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/dist/ApiError.d.ts +139 -55
- package/dist/ApiError.js +209 -67
- package/dist/FileIndex.d.ts +31 -59
- package/dist/FileIndex.js +5 -5
- package/dist/backends/AsyncStore.d.ts +8 -2
- package/dist/backends/Overlay.js +0 -1
- package/dist/backends/backend.d.ts +1 -1
- package/dist/browser.min.js +4 -4
- package/dist/browser.min.js.map +3 -3
- package/dist/emulation/async.d.ts +82 -81
- package/dist/emulation/async.js +2 -2
- package/dist/emulation/dir.d.ts +3 -3
- package/dist/emulation/streams.d.ts +3 -3
- package/dist/filesystem.d.ts +2 -10
- package/dist/filesystem.js +2 -2
- package/dist/utils.d.ts +4 -23
- package/dist/utils.js +0 -9
- package/package.json +3 -2
package/dist/ApiError.d.ts
CHANGED
|
@@ -2,86 +2,170 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Standard libc error codes. More will be added to this enum and ErrorStrings as they are
|
|
4
4
|
* needed.
|
|
5
|
-
* @url
|
|
5
|
+
* @url https://en.wikipedia.org/wiki/Errno.h
|
|
6
6
|
*/
|
|
7
7
|
export declare enum ErrorCode {
|
|
8
|
-
/**
|
|
9
|
-
* Operation not permitted
|
|
10
|
-
*/
|
|
8
|
+
/** Operation not permitted */
|
|
11
9
|
EPERM = 1,
|
|
12
|
-
/**
|
|
13
|
-
* No such file or directory
|
|
14
|
-
*/
|
|
10
|
+
/** No such file or directory */
|
|
15
11
|
ENOENT = 2,
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
/** Interrupted system call */
|
|
13
|
+
EINTR = 4,
|
|
14
|
+
/** Input/output error */
|
|
19
15
|
EIO = 5,
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
/** No such device or address */
|
|
17
|
+
ENXIO = 6,
|
|
18
|
+
/** Bad file descriptor */
|
|
23
19
|
EBADF = 9,
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
/** Resource temporarily unavailable */
|
|
21
|
+
EAGAIN = 11,
|
|
22
|
+
/** Cannot allocate memory */
|
|
23
|
+
ENOMEM = 12,
|
|
24
|
+
/** Permission denied */
|
|
27
25
|
EACCES = 13,
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/** Bad address */
|
|
27
|
+
EFAULT = 14,
|
|
28
|
+
/** Block device required */
|
|
29
|
+
ENOTBLK = 15,
|
|
30
|
+
/** Resource busy or locked */
|
|
31
31
|
EBUSY = 16,
|
|
32
|
-
/**
|
|
33
|
-
* File exists
|
|
34
|
-
*/
|
|
32
|
+
/** File exists */
|
|
35
33
|
EEXIST = 17,
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
/** Invalid cross-device link */
|
|
35
|
+
EXDEV = 18,
|
|
36
|
+
/** No such device */
|
|
37
|
+
ENODEV = 19,
|
|
38
|
+
/** File is not a directory */
|
|
39
39
|
ENOTDIR = 20,
|
|
40
|
-
/**
|
|
41
|
-
* File is a directory
|
|
42
|
-
*/
|
|
40
|
+
/** File is a directory */
|
|
43
41
|
EISDIR = 21,
|
|
44
|
-
/**
|
|
45
|
-
* Invalid argument
|
|
46
|
-
*/
|
|
42
|
+
/** Invalid argument */
|
|
47
43
|
EINVAL = 22,
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
/** Too many open files in system */
|
|
45
|
+
ENFILE = 23,
|
|
46
|
+
/** Too many open files */
|
|
47
|
+
EMFILE = 24,
|
|
48
|
+
/** Text file busy */
|
|
49
|
+
ETXTBSY = 26,
|
|
50
|
+
/** File is too big */
|
|
51
51
|
EFBIG = 27,
|
|
52
|
-
/**
|
|
53
|
-
* No space left on disk
|
|
54
|
-
*/
|
|
52
|
+
/** No space left on disk */
|
|
55
53
|
ENOSPC = 28,
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
/** Illegal seek */
|
|
55
|
+
ESPIPE = 29,
|
|
56
|
+
/** Cannot modify a read-only file system */
|
|
59
57
|
EROFS = 30,
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
/** Too many links */
|
|
59
|
+
EMLINK = 31,
|
|
60
|
+
/** Broken pipe */
|
|
61
|
+
EPIPE = 32,
|
|
62
|
+
/** Numerical argument out of domain */
|
|
63
|
+
EDOM = 33,
|
|
64
|
+
/** Numerical result out of range */
|
|
65
|
+
ERANGE = 34,
|
|
66
|
+
/** Resource deadlock would occur */
|
|
63
67
|
EDEADLK = 35,
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
/** File name too long */
|
|
69
|
+
ENAMETOOLONG = 36,
|
|
70
|
+
/** No locks available */
|
|
71
|
+
ENOLCK = 37,
|
|
72
|
+
/** Function not implemented */
|
|
73
|
+
ENOSYS = 38,
|
|
74
|
+
/** Directory is not empty */
|
|
67
75
|
ENOTEMPTY = 39,
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
/** Too many levels of symbolic links */
|
|
77
|
+
ELOOP = 40,
|
|
78
|
+
/** No message of desired type */
|
|
79
|
+
ENOMSG = 42,
|
|
80
|
+
/** Invalid exchange */
|
|
81
|
+
EBADE = 52,
|
|
82
|
+
/** Invalid request descriptor */
|
|
83
|
+
EBADR = 53,
|
|
84
|
+
/** Exchange full */
|
|
85
|
+
EXFULL = 54,
|
|
86
|
+
/** No anode */
|
|
87
|
+
ENOANO = 55,
|
|
88
|
+
/** Invalid request code */
|
|
89
|
+
EBADRQC = 56,
|
|
90
|
+
/** Device not a stream */
|
|
91
|
+
ENOSTR = 60,
|
|
92
|
+
/** No data available */
|
|
93
|
+
ENODATA = 61,
|
|
94
|
+
/** Timer expired */
|
|
95
|
+
ETIME = 62,
|
|
96
|
+
/** Out of streams resources */
|
|
97
|
+
ENOSR = 63,
|
|
98
|
+
/** Machine is not on the network */
|
|
99
|
+
ENONET = 64,
|
|
100
|
+
/** Object is remote */
|
|
101
|
+
EREMOTE = 66,
|
|
102
|
+
/** Link has been severed */
|
|
103
|
+
ENOLINK = 67,
|
|
104
|
+
/** Communication error on send */
|
|
105
|
+
ECOMM = 70,
|
|
106
|
+
/** Protocol error */
|
|
107
|
+
EPROTO = 71,
|
|
108
|
+
/** Bad message */
|
|
109
|
+
EBADMSG = 74,
|
|
110
|
+
/** Value too large for defined data type */
|
|
111
|
+
EOVERFLOW = 75,
|
|
112
|
+
/** File descriptor in bad state */
|
|
113
|
+
EBADFD = 77,
|
|
114
|
+
/** Streams pipe error */
|
|
115
|
+
ESTRPIPE = 86,
|
|
116
|
+
/** Socket operation on non-socket */
|
|
117
|
+
ENOTSOCK = 88,
|
|
118
|
+
/** Destination address required */
|
|
119
|
+
EDESTADDRREQ = 89,
|
|
120
|
+
/** Message too long */
|
|
121
|
+
EMSGSIZE = 90,
|
|
122
|
+
/** Protocol wrong type for socket */
|
|
123
|
+
EPROTOTYPE = 91,
|
|
124
|
+
/** Protocol not available */
|
|
125
|
+
ENOPROTOOPT = 92,
|
|
126
|
+
/** Protocol not supported */
|
|
127
|
+
EPROTONOSUPPORT = 93,
|
|
128
|
+
/** Socket type not supported */
|
|
129
|
+
ESOCKTNOSUPPORT = 94,
|
|
130
|
+
/** Operation is not supported */
|
|
131
|
+
ENOTSUP = 95,
|
|
132
|
+
/** Network is down */
|
|
133
|
+
ENETDOWN = 100,
|
|
134
|
+
/** Network is unreachable */
|
|
135
|
+
ENETUNREACH = 101,
|
|
136
|
+
/** Network dropped connection on reset */
|
|
137
|
+
ENETRESET = 102,
|
|
138
|
+
/** Connection timed out */
|
|
139
|
+
ETIMEDOUT = 110,
|
|
140
|
+
/** Connection refused */
|
|
141
|
+
ECONNREFUSED = 111,
|
|
142
|
+
/** Host is down */
|
|
143
|
+
EHOSTDOWN = 112,
|
|
144
|
+
/** No route to host */
|
|
145
|
+
EHOSTUNREACH = 113,
|
|
146
|
+
/** Operation already in progress */
|
|
147
|
+
EALREADY = 114,
|
|
148
|
+
/** Operation now in progress */
|
|
149
|
+
EINPROGRESS = 115,
|
|
150
|
+
/** Stale file handle */
|
|
151
|
+
ESTALE = 116,
|
|
152
|
+
/** Remote I/O error */
|
|
153
|
+
EREMOTEIO = 121,
|
|
154
|
+
/** Disk quota exceeded */
|
|
155
|
+
EDQUOT = 122
|
|
72
156
|
}
|
|
73
157
|
/**
|
|
74
158
|
* Strings associated with each error code.
|
|
75
159
|
* @internal
|
|
76
160
|
*/
|
|
77
|
-
export declare const
|
|
78
|
-
[
|
|
161
|
+
export declare const errorMessages: {
|
|
162
|
+
[K in ErrorCode]: string;
|
|
79
163
|
};
|
|
80
164
|
interface ApiErrorJSON {
|
|
81
165
|
errno: ErrorCode;
|
|
82
166
|
message: string;
|
|
83
167
|
path?: string;
|
|
84
|
-
code:
|
|
168
|
+
code: keyof typeof ErrorCode;
|
|
85
169
|
stack: string;
|
|
86
170
|
syscall: string;
|
|
87
171
|
}
|
|
@@ -94,8 +178,8 @@ export declare class ApiError extends Error implements NodeJS.ErrnoException {
|
|
|
94
178
|
path?: string;
|
|
95
179
|
syscall: string;
|
|
96
180
|
static fromJSON(json: ApiErrorJSON): ApiError;
|
|
97
|
-
static With(code:
|
|
98
|
-
code:
|
|
181
|
+
static With(code: keyof typeof ErrorCode, path: string, syscall?: string): ApiError;
|
|
182
|
+
code: keyof typeof ErrorCode;
|
|
99
183
|
/**
|
|
100
184
|
* Represents a ZenFS error. Passed back to applications after a failed
|
|
101
185
|
* call to the ZenFS API.
|
package/dist/ApiError.js
CHANGED
|
@@ -1,96 +1,238 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Standard libc error codes. More will be added to this enum and ErrorStrings as they are
|
|
3
3
|
* needed.
|
|
4
|
-
* @url
|
|
4
|
+
* @url https://en.wikipedia.org/wiki/Errno.h
|
|
5
5
|
*/
|
|
6
6
|
export var ErrorCode;
|
|
7
7
|
(function (ErrorCode) {
|
|
8
|
-
/**
|
|
9
|
-
* Operation not permitted
|
|
10
|
-
*/
|
|
8
|
+
/** Operation not permitted */
|
|
11
9
|
ErrorCode[ErrorCode["EPERM"] = 1] = "EPERM";
|
|
12
|
-
/**
|
|
13
|
-
* No such file or directory
|
|
14
|
-
*/
|
|
10
|
+
/** No such file or directory */
|
|
15
11
|
ErrorCode[ErrorCode["ENOENT"] = 2] = "ENOENT";
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
/** Interrupted system call */
|
|
13
|
+
ErrorCode[ErrorCode["EINTR"] = 4] = "EINTR";
|
|
14
|
+
/** Input/output error */
|
|
19
15
|
ErrorCode[ErrorCode["EIO"] = 5] = "EIO";
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
/** No such device or address */
|
|
17
|
+
ErrorCode[ErrorCode["ENXIO"] = 6] = "ENXIO";
|
|
18
|
+
/** Bad file descriptor */
|
|
23
19
|
ErrorCode[ErrorCode["EBADF"] = 9] = "EBADF";
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
/** Resource temporarily unavailable */
|
|
21
|
+
ErrorCode[ErrorCode["EAGAIN"] = 11] = "EAGAIN";
|
|
22
|
+
/** Cannot allocate memory */
|
|
23
|
+
ErrorCode[ErrorCode["ENOMEM"] = 12] = "ENOMEM";
|
|
24
|
+
/** Permission denied */
|
|
27
25
|
ErrorCode[ErrorCode["EACCES"] = 13] = "EACCES";
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/** Bad address */
|
|
27
|
+
ErrorCode[ErrorCode["EFAULT"] = 14] = "EFAULT";
|
|
28
|
+
/** Block device required */
|
|
29
|
+
ErrorCode[ErrorCode["ENOTBLK"] = 15] = "ENOTBLK";
|
|
30
|
+
/** Resource busy or locked */
|
|
31
31
|
ErrorCode[ErrorCode["EBUSY"] = 16] = "EBUSY";
|
|
32
|
-
/**
|
|
33
|
-
* File exists
|
|
34
|
-
*/
|
|
32
|
+
/** File exists */
|
|
35
33
|
ErrorCode[ErrorCode["EEXIST"] = 17] = "EEXIST";
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
/** Invalid cross-device link */
|
|
35
|
+
ErrorCode[ErrorCode["EXDEV"] = 18] = "EXDEV";
|
|
36
|
+
/** No such device */
|
|
37
|
+
ErrorCode[ErrorCode["ENODEV"] = 19] = "ENODEV";
|
|
38
|
+
/** File is not a directory */
|
|
39
39
|
ErrorCode[ErrorCode["ENOTDIR"] = 20] = "ENOTDIR";
|
|
40
|
-
/**
|
|
41
|
-
* File is a directory
|
|
42
|
-
*/
|
|
40
|
+
/** File is a directory */
|
|
43
41
|
ErrorCode[ErrorCode["EISDIR"] = 21] = "EISDIR";
|
|
44
|
-
/**
|
|
45
|
-
* Invalid argument
|
|
46
|
-
*/
|
|
42
|
+
/** Invalid argument */
|
|
47
43
|
ErrorCode[ErrorCode["EINVAL"] = 22] = "EINVAL";
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
/** Too many open files in system */
|
|
45
|
+
ErrorCode[ErrorCode["ENFILE"] = 23] = "ENFILE";
|
|
46
|
+
/** Too many open files */
|
|
47
|
+
ErrorCode[ErrorCode["EMFILE"] = 24] = "EMFILE";
|
|
48
|
+
/** Text file busy */
|
|
49
|
+
ErrorCode[ErrorCode["ETXTBSY"] = 26] = "ETXTBSY";
|
|
50
|
+
/** File is too big */
|
|
51
51
|
ErrorCode[ErrorCode["EFBIG"] = 27] = "EFBIG";
|
|
52
|
-
/**
|
|
53
|
-
* No space left on disk
|
|
54
|
-
*/
|
|
52
|
+
/** No space left on disk */
|
|
55
53
|
ErrorCode[ErrorCode["ENOSPC"] = 28] = "ENOSPC";
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
/** Illegal seek */
|
|
55
|
+
ErrorCode[ErrorCode["ESPIPE"] = 29] = "ESPIPE";
|
|
56
|
+
/** Cannot modify a read-only file system */
|
|
59
57
|
ErrorCode[ErrorCode["EROFS"] = 30] = "EROFS";
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
/** Too many links */
|
|
59
|
+
ErrorCode[ErrorCode["EMLINK"] = 31] = "EMLINK";
|
|
60
|
+
/** Broken pipe */
|
|
61
|
+
ErrorCode[ErrorCode["EPIPE"] = 32] = "EPIPE";
|
|
62
|
+
/** Numerical argument out of domain */
|
|
63
|
+
ErrorCode[ErrorCode["EDOM"] = 33] = "EDOM";
|
|
64
|
+
/** Numerical result out of range */
|
|
65
|
+
ErrorCode[ErrorCode["ERANGE"] = 34] = "ERANGE";
|
|
66
|
+
/** Resource deadlock would occur */
|
|
63
67
|
ErrorCode[ErrorCode["EDEADLK"] = 35] = "EDEADLK";
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
/** File name too long */
|
|
69
|
+
ErrorCode[ErrorCode["ENAMETOOLONG"] = 36] = "ENAMETOOLONG";
|
|
70
|
+
/** No locks available */
|
|
71
|
+
ErrorCode[ErrorCode["ENOLCK"] = 37] = "ENOLCK";
|
|
72
|
+
/** Function not implemented */
|
|
73
|
+
ErrorCode[ErrorCode["ENOSYS"] = 38] = "ENOSYS";
|
|
74
|
+
/** Directory is not empty */
|
|
67
75
|
ErrorCode[ErrorCode["ENOTEMPTY"] = 39] = "ENOTEMPTY";
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
/** Too many levels of symbolic links */
|
|
77
|
+
ErrorCode[ErrorCode["ELOOP"] = 40] = "ELOOP";
|
|
78
|
+
/** No message of desired type */
|
|
79
|
+
ErrorCode[ErrorCode["ENOMSG"] = 42] = "ENOMSG";
|
|
80
|
+
/** Invalid exchange */
|
|
81
|
+
ErrorCode[ErrorCode["EBADE"] = 52] = "EBADE";
|
|
82
|
+
/** Invalid request descriptor */
|
|
83
|
+
ErrorCode[ErrorCode["EBADR"] = 53] = "EBADR";
|
|
84
|
+
/** Exchange full */
|
|
85
|
+
ErrorCode[ErrorCode["EXFULL"] = 54] = "EXFULL";
|
|
86
|
+
/** No anode */
|
|
87
|
+
ErrorCode[ErrorCode["ENOANO"] = 55] = "ENOANO";
|
|
88
|
+
/** Invalid request code */
|
|
89
|
+
ErrorCode[ErrorCode["EBADRQC"] = 56] = "EBADRQC";
|
|
90
|
+
/** Device not a stream */
|
|
91
|
+
ErrorCode[ErrorCode["ENOSTR"] = 60] = "ENOSTR";
|
|
92
|
+
/** No data available */
|
|
93
|
+
ErrorCode[ErrorCode["ENODATA"] = 61] = "ENODATA";
|
|
94
|
+
/** Timer expired */
|
|
95
|
+
ErrorCode[ErrorCode["ETIME"] = 62] = "ETIME";
|
|
96
|
+
/** Out of streams resources */
|
|
97
|
+
ErrorCode[ErrorCode["ENOSR"] = 63] = "ENOSR";
|
|
98
|
+
/** Machine is not on the network */
|
|
99
|
+
ErrorCode[ErrorCode["ENONET"] = 64] = "ENONET";
|
|
100
|
+
/** Object is remote */
|
|
101
|
+
ErrorCode[ErrorCode["EREMOTE"] = 66] = "EREMOTE";
|
|
102
|
+
/** Link has been severed */
|
|
103
|
+
ErrorCode[ErrorCode["ENOLINK"] = 67] = "ENOLINK";
|
|
104
|
+
/** Communication error on send */
|
|
105
|
+
ErrorCode[ErrorCode["ECOMM"] = 70] = "ECOMM";
|
|
106
|
+
/** Protocol error */
|
|
107
|
+
ErrorCode[ErrorCode["EPROTO"] = 71] = "EPROTO";
|
|
108
|
+
/** Bad message */
|
|
109
|
+
ErrorCode[ErrorCode["EBADMSG"] = 74] = "EBADMSG";
|
|
110
|
+
/** Value too large for defined data type */
|
|
111
|
+
ErrorCode[ErrorCode["EOVERFLOW"] = 75] = "EOVERFLOW";
|
|
112
|
+
/** File descriptor in bad state */
|
|
113
|
+
ErrorCode[ErrorCode["EBADFD"] = 77] = "EBADFD";
|
|
114
|
+
/** Streams pipe error */
|
|
115
|
+
ErrorCode[ErrorCode["ESTRPIPE"] = 86] = "ESTRPIPE";
|
|
116
|
+
/** Socket operation on non-socket */
|
|
117
|
+
ErrorCode[ErrorCode["ENOTSOCK"] = 88] = "ENOTSOCK";
|
|
118
|
+
/** Destination address required */
|
|
119
|
+
ErrorCode[ErrorCode["EDESTADDRREQ"] = 89] = "EDESTADDRREQ";
|
|
120
|
+
/** Message too long */
|
|
121
|
+
ErrorCode[ErrorCode["EMSGSIZE"] = 90] = "EMSGSIZE";
|
|
122
|
+
/** Protocol wrong type for socket */
|
|
123
|
+
ErrorCode[ErrorCode["EPROTOTYPE"] = 91] = "EPROTOTYPE";
|
|
124
|
+
/** Protocol not available */
|
|
125
|
+
ErrorCode[ErrorCode["ENOPROTOOPT"] = 92] = "ENOPROTOOPT";
|
|
126
|
+
/** Protocol not supported */
|
|
127
|
+
ErrorCode[ErrorCode["EPROTONOSUPPORT"] = 93] = "EPROTONOSUPPORT";
|
|
128
|
+
/** Socket type not supported */
|
|
129
|
+
ErrorCode[ErrorCode["ESOCKTNOSUPPORT"] = 94] = "ESOCKTNOSUPPORT";
|
|
130
|
+
/** Operation is not supported */
|
|
71
131
|
ErrorCode[ErrorCode["ENOTSUP"] = 95] = "ENOTSUP";
|
|
132
|
+
/** Network is down */
|
|
133
|
+
ErrorCode[ErrorCode["ENETDOWN"] = 100] = "ENETDOWN";
|
|
134
|
+
/** Network is unreachable */
|
|
135
|
+
ErrorCode[ErrorCode["ENETUNREACH"] = 101] = "ENETUNREACH";
|
|
136
|
+
/** Network dropped connection on reset */
|
|
137
|
+
ErrorCode[ErrorCode["ENETRESET"] = 102] = "ENETRESET";
|
|
138
|
+
/** Connection timed out */
|
|
139
|
+
ErrorCode[ErrorCode["ETIMEDOUT"] = 110] = "ETIMEDOUT";
|
|
140
|
+
/** Connection refused */
|
|
141
|
+
ErrorCode[ErrorCode["ECONNREFUSED"] = 111] = "ECONNREFUSED";
|
|
142
|
+
/** Host is down */
|
|
143
|
+
ErrorCode[ErrorCode["EHOSTDOWN"] = 112] = "EHOSTDOWN";
|
|
144
|
+
/** No route to host */
|
|
145
|
+
ErrorCode[ErrorCode["EHOSTUNREACH"] = 113] = "EHOSTUNREACH";
|
|
146
|
+
/** Operation already in progress */
|
|
147
|
+
ErrorCode[ErrorCode["EALREADY"] = 114] = "EALREADY";
|
|
148
|
+
/** Operation now in progress */
|
|
149
|
+
ErrorCode[ErrorCode["EINPROGRESS"] = 115] = "EINPROGRESS";
|
|
150
|
+
/** Stale file handle */
|
|
151
|
+
ErrorCode[ErrorCode["ESTALE"] = 116] = "ESTALE";
|
|
152
|
+
/** Remote I/O error */
|
|
153
|
+
ErrorCode[ErrorCode["EREMOTEIO"] = 121] = "EREMOTEIO";
|
|
154
|
+
/** Disk quota exceeded */
|
|
155
|
+
ErrorCode[ErrorCode["EDQUOT"] = 122] = "EDQUOT";
|
|
72
156
|
})(ErrorCode = ErrorCode || (ErrorCode = {}));
|
|
73
157
|
/**
|
|
74
158
|
* Strings associated with each error code.
|
|
75
159
|
* @internal
|
|
76
160
|
*/
|
|
77
|
-
export const
|
|
78
|
-
[ErrorCode.EPERM]: 'Operation not permitted
|
|
79
|
-
[ErrorCode.ENOENT]: 'No such file or directory
|
|
80
|
-
[ErrorCode.
|
|
81
|
-
[ErrorCode.
|
|
82
|
-
[ErrorCode.
|
|
83
|
-
[ErrorCode.
|
|
84
|
-
[ErrorCode.
|
|
85
|
-
[ErrorCode.
|
|
86
|
-
[ErrorCode.
|
|
87
|
-
[ErrorCode.
|
|
88
|
-
[ErrorCode.
|
|
89
|
-
[ErrorCode.
|
|
90
|
-
[ErrorCode.
|
|
161
|
+
export const errorMessages = {
|
|
162
|
+
[ErrorCode.EPERM]: 'Operation not permitted',
|
|
163
|
+
[ErrorCode.ENOENT]: 'No such file or directory',
|
|
164
|
+
[ErrorCode.EINTR]: 'Interrupted system call',
|
|
165
|
+
[ErrorCode.EIO]: 'Input/output error',
|
|
166
|
+
[ErrorCode.ENXIO]: 'No such device or address',
|
|
167
|
+
[ErrorCode.EBADF]: 'Bad file descriptor',
|
|
168
|
+
[ErrorCode.EAGAIN]: 'Resource temporarily unavailable',
|
|
169
|
+
[ErrorCode.ENOMEM]: 'Cannot allocate memory',
|
|
170
|
+
[ErrorCode.EACCES]: 'Permission denied',
|
|
171
|
+
[ErrorCode.EFAULT]: 'Bad address',
|
|
172
|
+
[ErrorCode.ENOTBLK]: 'Block device required',
|
|
173
|
+
[ErrorCode.EBUSY]: 'Resource busy or locked',
|
|
174
|
+
[ErrorCode.EEXIST]: 'File exists',
|
|
175
|
+
[ErrorCode.EXDEV]: 'Invalid cross-device link',
|
|
176
|
+
[ErrorCode.ENODEV]: 'No such device',
|
|
177
|
+
[ErrorCode.ENOTDIR]: 'File is not a directory',
|
|
178
|
+
[ErrorCode.EISDIR]: 'File is a directory',
|
|
179
|
+
[ErrorCode.EINVAL]: 'Invalid argument',
|
|
180
|
+
[ErrorCode.ENFILE]: 'Too many open files in system',
|
|
181
|
+
[ErrorCode.EMFILE]: 'Too many open files',
|
|
182
|
+
[ErrorCode.ETXTBSY]: 'Text file busy',
|
|
183
|
+
[ErrorCode.EFBIG]: 'File is too big',
|
|
184
|
+
[ErrorCode.ENOSPC]: 'No space left on disk',
|
|
185
|
+
[ErrorCode.ESPIPE]: 'Illegal seek',
|
|
186
|
+
[ErrorCode.EROFS]: 'Cannot modify a read-only file system',
|
|
187
|
+
[ErrorCode.EMLINK]: 'Too many links',
|
|
188
|
+
[ErrorCode.EPIPE]: 'Broken pipe',
|
|
189
|
+
[ErrorCode.EDOM]: 'Numerical argument out of domain',
|
|
190
|
+
[ErrorCode.ERANGE]: 'Numerical result out of range',
|
|
91
191
|
[ErrorCode.EDEADLK]: 'Resource deadlock would occur',
|
|
92
|
-
[ErrorCode.
|
|
93
|
-
[ErrorCode.
|
|
192
|
+
[ErrorCode.ENAMETOOLONG]: 'File name too long',
|
|
193
|
+
[ErrorCode.ENOLCK]: 'No locks available',
|
|
194
|
+
[ErrorCode.ENOSYS]: 'Function not implemented',
|
|
195
|
+
[ErrorCode.ENOTEMPTY]: 'Directory is not empty',
|
|
196
|
+
[ErrorCode.ELOOP]: 'Too many levels of symbolic links',
|
|
197
|
+
[ErrorCode.ENOMSG]: 'No message of desired type',
|
|
198
|
+
[ErrorCode.EBADE]: 'Invalid exchange',
|
|
199
|
+
[ErrorCode.EBADR]: 'Invalid request descriptor',
|
|
200
|
+
[ErrorCode.EXFULL]: 'Exchange full',
|
|
201
|
+
[ErrorCode.ENOANO]: 'No anode',
|
|
202
|
+
[ErrorCode.EBADRQC]: 'Invalid request code',
|
|
203
|
+
[ErrorCode.ENOSTR]: 'Device not a stream',
|
|
204
|
+
[ErrorCode.ENODATA]: 'No data available',
|
|
205
|
+
[ErrorCode.ETIME]: 'Timer expired',
|
|
206
|
+
[ErrorCode.ENOSR]: 'Out of streams resources',
|
|
207
|
+
[ErrorCode.ENONET]: 'Machine is not on the network',
|
|
208
|
+
[ErrorCode.EREMOTE]: 'Object is remote',
|
|
209
|
+
[ErrorCode.ENOLINK]: 'Link has been severed',
|
|
210
|
+
[ErrorCode.ECOMM]: 'Communication error on send',
|
|
211
|
+
[ErrorCode.EPROTO]: 'Protocol error',
|
|
212
|
+
[ErrorCode.EBADMSG]: 'Bad message',
|
|
213
|
+
[ErrorCode.EOVERFLOW]: 'Value too large for defined data type',
|
|
214
|
+
[ErrorCode.EBADFD]: 'File descriptor in bad state',
|
|
215
|
+
[ErrorCode.ESTRPIPE]: 'Streams pipe error',
|
|
216
|
+
[ErrorCode.ENOTSOCK]: 'Socket operation on non-socket',
|
|
217
|
+
[ErrorCode.EDESTADDRREQ]: 'Destination address required',
|
|
218
|
+
[ErrorCode.EMSGSIZE]: 'Message too long',
|
|
219
|
+
[ErrorCode.EPROTOTYPE]: 'Protocol wrong type for socket',
|
|
220
|
+
[ErrorCode.ENOPROTOOPT]: 'Protocol not available',
|
|
221
|
+
[ErrorCode.EPROTONOSUPPORT]: 'Protocol not supported',
|
|
222
|
+
[ErrorCode.ESOCKTNOSUPPORT]: 'Socket type not supported',
|
|
223
|
+
[ErrorCode.ENOTSUP]: 'Operation is not supported',
|
|
224
|
+
[ErrorCode.ENETDOWN]: 'Network is down',
|
|
225
|
+
[ErrorCode.ENETUNREACH]: 'Network is unreachable',
|
|
226
|
+
[ErrorCode.ENETRESET]: 'Network dropped connection on reset',
|
|
227
|
+
[ErrorCode.ETIMEDOUT]: 'Connection timed out',
|
|
228
|
+
[ErrorCode.ECONNREFUSED]: 'Connection refused',
|
|
229
|
+
[ErrorCode.EHOSTDOWN]: 'Host is down',
|
|
230
|
+
[ErrorCode.EHOSTUNREACH]: 'No route to host',
|
|
231
|
+
[ErrorCode.EALREADY]: 'Operation already in progress',
|
|
232
|
+
[ErrorCode.EINPROGRESS]: 'Operation now in progress',
|
|
233
|
+
[ErrorCode.ESTALE]: 'Stale file handle',
|
|
234
|
+
[ErrorCode.EREMOTEIO]: 'Remote I/O error',
|
|
235
|
+
[ErrorCode.EDQUOT]: 'Disk quota exceeded',
|
|
94
236
|
};
|
|
95
237
|
/**
|
|
96
238
|
* Represents a ZenFS error. Passed back to applications after a failed
|
|
@@ -104,7 +246,7 @@ export class ApiError extends Error {
|
|
|
104
246
|
return err;
|
|
105
247
|
}
|
|
106
248
|
static With(code, path, syscall) {
|
|
107
|
-
return new ApiError(ErrorCode[code],
|
|
249
|
+
return new ApiError(ErrorCode[code], errorMessages[ErrorCode[code]], path, syscall);
|
|
108
250
|
}
|
|
109
251
|
/**
|
|
110
252
|
* Represents a ZenFS error. Passed back to applications after a failed
|
|
@@ -116,7 +258,7 @@ export class ApiError extends Error {
|
|
|
116
258
|
* @param type The type of the error.
|
|
117
259
|
* @param message A descriptive error message.
|
|
118
260
|
*/
|
|
119
|
-
constructor(errno, message =
|
|
261
|
+
constructor(errno, message = errorMessages[errno], path, syscall = '') {
|
|
120
262
|
super(message);
|
|
121
263
|
this.errno = errno;
|
|
122
264
|
this.path = path;
|