Module sys/errors
IOError type — comprehensive I/O error type with errno-to-error mapping.
Types
Generic I/O error (EIO).
Variants
| Variant | Fields | Description |
|---|---|---|
NotFound | File or directory not found (ENOENT). | |
PermissionDenied | Permission denied (EACCES, EPERM). | |
AlreadyExists | File or directory already exists (EEXIST). | |
NotADirectory | Not a directory (ENOTDIR). | |
IsADirectory | Is a directory (EISDIR). | |
DirectoryNotEmpty | Directory not empty (ENOTEMPTY). | |
BrokenPipe | Broken pipe (EPIPE). | |
WouldBlock | Operation would block (EAGAIN, EWOULDBLOCK). | |
InvalidInput | Invalid argument (EINVAL). | |
Interrupted | Interrupted system call (EINTR). | |
TooManyOpenFiles | Too many open files (EMFILE, ENFILE). | |
FileTooLarge | File too large (EFBIG). | |
NoSpace | No space left on device (ENOSPC). | |
ReadOnlyFilesystem | Read-only filesystem (EROFS). | |
CrossDeviceLink | Cross-device link (EXDEV). | |
TooManyLinks | Too many links (EMLINK). | |
NameTooLong | File name too long (ENAMETOOLONG). | |
NotSupported | Operation not supported (ENOTSUP, EOPNOTSUPP). | |
TimedOut | Operation timed out (ETIMEDOUT). | |
Busy | Resource busy (EBUSY). | |
BadFileDescriptor | Bad file descriptor (EBADF). | |
IOError | Generic I/O error (EIO). | |
ConnectionRefused | Connection refused (ECONNREFUSED). | |
ConnectionReset | Connection reset by peer (ECONNRESET). | |
ConnectionAborted | Connection aborted (ECONNABORTED). | |
NotConnected | Not connected (ENOTCONN). | |
AddressInUse | Address already in use (EADDRINUSE). | |
AddressNotAvailable | Address not available (EADDRNOTAVAIL). | |
NetworkUnreachable | Network unreachable (ENETUNREACH). | |
HostUnreachable | Host unreachable (EHOSTUNREACH). | |
NetworkDown | Network is down (ENETDOWN). | |
AlreadyConnected | Already connected (EISCONN). | |
Other | code: i32 | Other error with raw errno code. |
Trait Implementations
impl(IOError, ...)
from_errno : (IOError) fn(errno : i32) -> IOErrorimpl(IOError, ToString(...))
to_string : (self -> {
s := match(self,
.NotFound => String.from("file or directory not found"),
.PermissionDenied => String.from("permission denied"),
.AlreadyExists => String.from("file or directory already exists"),
.NotADirectory => String.from("not a directory"),
.IsADirectory => String.from("is a directory"),
.DirectoryNotEmpty => String.from("directory not empty"),
.BrokenPipe => String.from("broken pipe"),
.WouldBlock => String.from("operation would block"),
.InvalidInput => String.from("invalid input"),
.Interrupted => String.from("operation interrupted"),
.TooManyOpenFiles => String.from("too many open files"),
.FileTooLarge => String.from("file too large"),
.NoSpace => String.from("no space left on device"),
.ReadOnlyFilesystem => String.from("read-only filesystem"),
.CrossDeviceLink => String.from("cross-device link"),
.TooManyLinks => String.from("too many links"),
.NameTooLong => String.from("name too long"),
.NotSupported => String.from("operation not supported"),
.TimedOut => String.from("operation timed out"),
.Busy => String.from("resource busy"),
.BadFileDescriptor => String.from("bad file descriptor"),
.IOError => String.from("I/O error"),
.ConnectionRefused => String.from("connection refused"),
.ConnectionReset => String.from("connection reset by peer"),
.ConnectionAborted => String.from("connection aborted"),
.NotConnected => String.from("socket not connected"),
.AddressInUse => String.from("address already in use"),
.AddressNotAvailable => String.from("address not available"),
.NetworkUnreachable => String.from("network unreachable"),
.HostUnreachable => String.from("host unreachable"),
.NetworkDown => String.from("network is down"),
.AlreadyConnected => String.from("socket already connected"),
.Other(errno) => String.from("unknown I/O error")
);
return s;
})impl(IOError, Error())
impl(IOError, ...)
check : (IOError) fn(result : i32, using(exn : Exception)) -> i32Parameters
| Name | Type | Notes |
|---|---|---|
result | i32 |
Returns: i32