Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more ErrorKinds #130193

Open
GrigorenkoPV opened this issue Sep 10, 2024 · 1 comment
Open

Add more ErrorKinds #130193

GrigorenkoPV opened this issue Sep 10, 2024 · 1 comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-io Area: `std::io`, `std::fs`, `std::net` and `std::path` C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@GrigorenkoPV
Copy link
Contributor

Misc UNIX

Originally posted by zackw in #79965 (comment)

I am surprised to see EMFILE, ENFILE, ENOMEM, ENOEXEC, EIO, ENOTTY, ENXIO, ENODEV, EOPNOTSUPP, ESRCH, ECHILD, and EINPROGRESS dismissed as unlikely to occur, or only relevant to people doing highly Unix-specific tasks. They can all happen at least as easily as some of the other situations for which codes are being added. I'd recommend all of these be added, with the following friendly names and descriptions. Some of them should be lumped together, however.

  • EIO: PhysicalIOError, "Data could not be input or output due to a hardware failure, such as a bad disk sector."
  • ESRCH and ECHILD: ProcessNotFound (or lump with the existing NotFound). "A process was not found" seems too vague and short, but the existing description for NotFound is also vague and short, so 🤷‍♂️
  • EINPROGRESS: InProgress. "An operation has begun, and will complete later. It is not yet known whether it will succeed."
  • EMFILE and ENFILE: TooManyOpenFiles. "The process cannot open any more files without closing some first, or the system as a whole cannot handle any more simultaneously open files."
  • ENOMEM: NotEnoughMemory. "The system does not have enough free memory to satisfy an allocation request. This can happen either because all of RAM is already allocated, or because the request was for more memory than the computer has."
  • ENOEXEC: InvalidExecutable. "A machine-language program is either corrupt or cannot be executed on this CPU (e.g. it is machine code for some other type of CPU)."
  • ENOTTY, ENXIO, ENODEV, EOPNOTSUPP: NotOperable, "This operation cannot be applied to this type of file or device. For example, changing terminal settings on something other than a terminal device."

EMFILE specifically

Was requested at least a couple of times

(I was not even looking for those, just noticed the reoccurring request while gathering info for the few previous issues I've opened.)

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 10, 2024
@lolbinarycat
Copy link
Contributor

i was going to say "the Display strings for ErrorKinds don't contain examples", but apparently, FilesystemLoop does!

that definitely seems like the exception, however. all the error strings are pretty short, as they would usually be combined with a more verbose description of the context around the description. the more verbose explanations generally belong in the docstrings.

@lolbinarycat lolbinarycat added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-io Area: `std::io`, `std::fs`, `std::net` and `std::path` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 10, 2024
@workingjubilee workingjubilee added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. and removed C-totally-not-a-tracking-issue labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-io Area: `std::io`, `std::fs`, `std::net` and `std::path` C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants