stable_fs/error.rs
1#[derive(Debug, PartialEq, Eq)]
2pub enum Error {
3 // Argument list too long: Too many or too large arguments provided to a program.
4 // WASI: ERRNO_2BIG
5 ArgumentListTooLong = 1,
6
7 // Permission denied: Insufficient privileges to perform the operation.
8 // WASI: ERRNO_ACCES
9 PermissionDenied = 2,
10
11 // Address in use: Network address or port already in use.
12 // WASI: ERRNO_ADDRINUSE
13 AddressInUse = 3,
14
15 // Address not available: The requested address is not available on this system.
16 // WASI: ERRNO_ADDRNOTAVAIL
17 AddressNotAvailable = 4,
18
19 // Address family not supported: Unsupported address family (e.g., IPv6 on an IPv4-only system).
20 // WASI: ERRNO_AFNOSUPPORT
21 AddressFamilyNotSupported = 5,
22
23 // Resource unavailable or operation would block: Non-blocking operation cannot proceed at this time.
24 // WASI: ERRNO_AGAIN
25 ResourceUnavailableOrOperationWouldBlock = 6,
26
27 // Connection already in progress: An operation is already attempting to establish a connection.
28 // WASI: ERRNO_ALREADY
29 ConnectionAlreadyInProgress = 7,
30
31 // Bad file descriptor: File descriptor is invalid or closed.
32 // WASI: ERRNO_BADF
33 BadFileDescriptor = 8,
34
35 // Bad message: The message is malformed or corrupted.
36 // WASI: ERRNO_BADMSG
37 BadMessage = 9,
38
39 // Device or resource busy: The resource is currently in use and cannot be accessed.
40 // WASI: ERRNO_BUSY
41 DeviceOrResourceBusy = 10,
42
43 // Operation canceled: The operation was canceled before completion.
44 // WASI: ERRNO_CANCELED
45 OperationCanceled = 11,
46
47 // No child processes: No child processes to wait for in a wait operation.
48 // WASI: ERRNO_CHILD
49 NoChildProcesses = 12,
50
51 // Connection aborted: The connection was aborted by the host or peer.
52 // WASI: ERRNO_CONNABORTED
53 ConnectionAborted = 13,
54
55 // Connection refused: The connection attempt was rejected by the remote host.
56 // WASI: ERRNO_CONNREFUSED
57 ConnectionRefused = 14,
58
59 // Connection reset: The connection was forcibly closed by the peer.
60 // WASI: ERRNO_CONNRESET
61 ConnectionReset = 15,
62
63 // Resource deadlock would occur: A deadlock was detected and the operation was aborted.
64 // WASI: ERRNO_DEADLK
65 ResourceDeadlockWouldOccur = 16,
66
67 // Destination address required: No destination address was provided for a network operation.
68 // WASI: ERRNO_DESTADDRREQ
69 DestinationAddressRequired = 17,
70
71 // Mathematics argument out of domain of function: Invalid input for a mathematical operation.
72 // WASI: ERRNO_DOM
73 MathematicsArgumentOutOfDomainOfFunction = 18,
74
75 // Reserved error code (not used).
76 // WASI: ERRNO_DQUOT
77 Reserved19 = 19,
78
79 // File exists: The file or directory already exists.
80 // WASI: ERRNO_EXIST
81 FileExists = 20,
82
83 // Bad address: A memory address is invalid or inaccessible.
84 // WASI: ERRNO_FAULT
85 BadAddress = 21,
86
87 // File too large: File size exceeds the system or application limits.
88 // WASI: ERRNO_FBIG
89 FileTooLarge = 22,
90
91 // Host is unreachable: The remote host cannot be reached.
92 // WASI: ERRNO_HOSTUNREACH
93 HostIsUnreachable = 23,
94
95 // Identifier removed: The requested identifier has been removed.
96 // WASI: ERRNO_IDRM
97 IdentifierRemoved = 24,
98
99 // Illegal byte sequence: An invalid or incomplete byte sequence was encountered.
100 // WASI: ERRNO_ILSEQ
101 IllegalByteSequence = 25,
102
103 // Operation in progress: A long-running operation is still ongoing.
104 // WASI: ERRNO_INPROGRESS
105 OperationInProgress = 26,
106
107 // Interrupted function: The operation was interrupted by a signal or event.
108 // WASI: ERRNO_INTR
109 InterruptedFunction = 27,
110
111 // Invalid argument: An argument passed to the function is invalid.
112 // WASI: ERRNO_INVAL
113 InvalidArgument = 28,
114
115 // I/O error: A low-level input/output operation failed.
116 // WASI: ERRNO_IO
117 IOError = 29,
118
119 // Socket is connected: The socket is already connected to a remote endpoint.
120 // WASI: ERRNO_ISCONN
121 SocketIsConnected = 30,
122
123 // Is a directory: The operation is not valid on a directory.
124 // WASI: ERRNO_ISDIR
125 IsDirectory = 31,
126
127 // Too many levels of symbolic links: A symbolic link loop was detected.
128 // WASI: ERRNO_LOOP
129 TooManyLevelsOfSymbolicLinks = 32,
130
131 // File descriptor value too large: File descriptor number exceeds the allowed range.
132 // WASI: ERRNO_MFILE
133 FileDescriptorValueTooLarge = 33,
134
135 // Too many links: The maximum number of hard links has been reached.
136 // WASI: ERRNO_MLINK
137 TooManyLinks = 34,
138
139 // Message too large: A network message exceeds the size limit.
140 // WASI: ERRNO_MSGSIZE
141 MessageTooLarge = 35,
142
143 // Reserved error code (not used).
144 // WASI: ERRNO_MULTIHOP
145 Reserved36 = 36,
146
147 // Filename too long: A file or directory name exceeds the allowed length.
148 // WASI: ERRNO_NAMETOOLONG
149 FilenameTooLong = 37,
150
151 // Network is down: The network is currently unavailable.
152 // WASI: ERRNO_NETDOWN
153 NetworkIsDown = 38,
154
155 // Connection aborted by network: A network issue caused the connection to be aborted.
156 // WASI: ERRNO_NETRESET
157 ConnectionAbortedByNetwork = 39,
158
159 // Network unreachable: The network cannot be accessed.
160 // WASI: ERRNO_NETUNREACH
161 NetworkUnreachable = 40,
162
163 // Too many files open in system: System-wide file descriptor limit exceeded.
164 // WASI: ERRNO_NFILE
165 TooManyFilesOpenInSystem = 41,
166
167 // No buffer space available: Insufficient buffer space for the operation.
168 // WASI: ERRNO_NOBUFS
169 NoBufferSpaceAvailable = 42,
170
171 // No such device: The requested device does not exist.
172 // WASI: ERRNO_NODEV
173 NoSuchDevice = 43,
174
175 // No such file or directory: The specified file or directory was not found.
176 // WASI: ERRNO_NOENT
177 NoSuchFileOrDirectory = 44,
178
179 // Executable file format error: The file is not a valid executable format.
180 // WASI: ERRNO_NOEXEC
181 ExecutableFileFormatError = 45,
182
183 // No locks available: The system has no more locks available for use.
184 // WASI: ERRNO_NOLCK
185 NoLocksAvailable = 46,
186
187 // Reserved error code (not used).
188 // WASI: ERRNO_NOLINK
189 Reserved47 = 47,
190
191 // Not enough space: Insufficient storage space for the operation.
192 // WASI: ERRNO_NOMEM
193 NotEnoughSpace = 48,
194
195 // No message of the desired type: A requested message type is unavailable.
196 // WASI: ERRNO_NOMSG
197 NoMessageOfTheDesiredType = 49,
198
199 // Protocol not available: The requested protocol is unavailable.
200 // WASI: ERRNO_NOPROTOOPT
201 ProtocolNotAvailable = 50,
202
203 // No space left on device: The storage device is full.
204 // WASI: ERRNO_NOSPC
205 NoSpaceLeftOnDevice = 51,
206
207 // Function not supported: The operation is not supported by the system or device.
208 // WASI: ERRNO_NOSYS
209 FunctionNotSupported = 52,
210
211 // Socket not connected: The socket is not connected to a remote endpoint.
212 // WASI: ERRNO_NOTCONN
213 SocketNotConnected = 53,
214
215 // Not a directory or symbolic link: The target is not a directory or valid symbolic link.
216 // WASI: ERRNO_NOTDIR
217 NotADirectoryOrSymbolicLink = 54,
218
219 // Directory not empty: Cannot delete a directory that is not empty.
220 // WASI: ERRNO_NOTEMPTY
221 DirectoryNotEmpty = 55,
222
223 // State not recoverable: A persistent state could not be restored.
224 // WASI: ERRNO_NOTRECOVERABLE
225 StateNotRecoverable = 56,
226
227 // Not a socket: The file descriptor is not a socket.
228 // WASI: ERRNO_NOTSOCK
229 NotASocket = 57,
230
231 // Not supported or operation not supported on socket: Unsupported operation on the socket.
232 // WASI: ERRNO_NOTSUP
233 NotSupportedOrOperationNotSupportedOnSocket = 58,
234
235 // Inappropriate I/O control operation: The ioctl operation is inappropriate for the device.
236 // WASI: ERRNO_NOTTY
237 InappropriateIOControlOperation = 59,
238
239 // No such device or address: The device or address does not exist.
240 // WASI: ERRNO_NXIO
241 NoSuchDeviceOrAddress = 60,
242
243 // Value too large to be stored in data type: A value exceeds the data type's range.
244 // WASI: ERRNO_OVERFLOW
245 ValueTooLargeToBeStoredInDataType = 61,
246
247 // Previous owner died: The previous owner of a mutex or resource has died.
248 // WASI: ERRNO_OWNERDEAD
249 PreviousOwnerDied = 62,
250
251 // Operation not permitted: The operation is prohibited by the system or security policy.
252 // WASI: ERRNO_PERM
253 OperationNotPermitted = 63,
254
255 // Broken pipe: A connection was closed while writing data.
256 // WASI: ERRNO_PIPE
257 BrokenPipe = 64,
258
259 // Protocol error: A protocol error occurred during communication.
260 // WASI: ERRNO_PROTO
261 ProtocolError = 65,
262
263 // Protocol not supported: The protocol is not supported by the system.
264 // WASI: ERRNO_PROTONOSUPPORT
265 ProtocolNotSupported = 66,
266
267 // Protocol wrong type for socket: The protocol does not match the socket type.
268 // WASI: ERRNO_PROTOTYPE
269 ProtocolWrongTypeForSocket = 67,
270
271 // Result too large: The result of an operation exceeds the allowable limit.
272 // WASI: ERRNO_RANGE
273 ResultTooLarge = 68,
274
275 // Read-only file system: Attempted to modify a read-only file system.
276 // WASI: ERRNO_ROFS
277 ReadOnlyFileSystem = 69,
278
279 // Invalid seek: An invalid file seek operation was attempted.
280 // WASI: ERRNO_SPIPE
281 InvalidSeek = 70,
282
283 // No such process: The specified process does not exist.
284 // WASI: ERRNO_SRCH
285 NoSuchProcess = 71,
286
287 // Reserved error code (not used).
288 // WASI: ERRNO_STALE
289 Reserved72 = 72,
290
291 // Connection timed out: The connection attempt timed out.
292 // WASI: ERRNO_TIMEDOUT
293 ConnectionTimedOut = 73,
294
295 // Text file busy: An attempt to modify an in-use text file.
296 // WASI: ERRNO_TXTBSY
297 TextFileBusy = 74,
298
299 // Cross-device link: An operation attempted to link across different devices.
300 // WASI: ERRNO_XDEV
301 CrossDeviceLink = 75,
302
303 // Extension capabilities insufficient: The required extension capabilities are missing.
304 // WASI: ERRNO_NOTCAPABLE
305 ExtensionCapabilitiesInsufficient = 76,
306}
307
308impl std::fmt::Display for Error {
309 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
310 write!(f, "{:?}", self)
311 }
312}
313
314impl std::error::Error for Error {}