Files

39 lines
2.2 KiB
Plaintext
Raw Permalink Normal View History

2026-10-26 10:14:11 -05:00
#! @file io_error.sakura
#! @author John Christman (sorakatadzuma@gmail.com)
#! @copyright Malunal Studios, LLC.
#! @license MIT
#!
#! Contains why reading or writing a stream, or an operation on a file, failed,
#! which `system` reports, and `std::io`'s streams give.
module system;
#! Why an operation on a file, a directory, or the working directory failed.
#!
#! Every operating system reports its failures by numbers of its own, and
#! `system::error_of` turns them into these, so the same failure is the same
#! member everywhere. A failure the members do not name is `other`, and
#! `unexpected_end` is one `std::io` finds itself, never the system. Only a
#! program that handles a signal is ever `interrupted`, and only in a wait for
#! something to arrive: a read, or a wait for a child, which it can try again.
pub enum io_error: u8 {
other, #! A failure none of the other members names.
not_found, #! Nothing is at the path, or a directory on the way to it is missing.
permission_denied, #! The program may not do this to the file.
already_exists, #! Something is already at the path.
not_a_directory, #! A directory was needed, and the path names something else.
is_a_directory, #! A file was needed, and the path names a directory.
directory_not_empty, #! The directory still holds something.
invalid, #! A path, handle, or argument the operation cannot take.
name_too_long, #! The path, or a name within it, is longer than the system takes.
busy, #! The file is in use in a way that stops this.
read_only, #! The file system holding the file is read only.
no_space, #! The device, or the user's share of it, is full.
too_many_open, #! The program, or the system, has as many files open as it may.
cross_device, #! A file cannot be renamed onto another device.
link_loop, #! Following the links in the path went around in a circle.
broken_pipe, #! What was written to has nothing reading it any more.
unsupported, #! The system does not do this.
unexpected_end, #! The input ended before all that was asked for was read.
interrupted, #! A signal the program handles came, ending the wait early.
}