-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
std::io functions should document which ErrorKinds they can return #40322
Comments
More specifically it should document which system error codes correspond to which |
I guess so, but that's system-dependent. We can say that |
I do not think it is in our interest to maintain descriptions of every possible failure. We already document what platform API some call corresponds to, so referring people to corresponding documentation seems entirely fine to me |
I don't know about our interest, but it seems to be in the users' interest
to avoid a round trip to system manpages.
…On Wed, Mar 8, 2017 at 7:11 AM, Simonas Kazlauskas ***@***.*** > wrote:
even if that is a different code on Windows vs Linux or whatever.
I do not think it is in our interest to maintain descriptions of every
possible failure. We already document what platform API some call
corresponds to, so referring people to corresponding documentation seems
entirely fine to me
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#40322 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n6b4y74e7DiYn8Dxcbaho9M24BLTks5rjprsgaJpZM4MVrhb>
.
|
Also I don't see where OpenOptions::open specifies a system call (I feel
like I'm nitpicking, since it's obviously(?) `open` on Linux, but I don't
know what it is on Windows).
…On Wed, Mar 8, 2017 at 9:52 AM, Alex Burka ***@***.***> wrote:
I don't know about our interest, but it seems to be in the users' interest
to avoid a round trip to system manpages.
On Wed, Mar 8, 2017 at 7:11 AM, Simonas Kazlauskas <
***@***.***> wrote:
> even if that is a different code on Windows vs Linux or whatever.
>
> I do not think it is in our interest to maintain descriptions of every
> possible failure. We already document what platform API some call
> corresponds to, so referring people to corresponding documentation seems
> entirely fine to me
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#40322 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAC3n6b4y74e7DiYn8Dxcbaho9M24BLTks5rjprsgaJpZM4MVrhb>
> .
>
|
triage: p-medium. putting it on the next doc team agenda |
Docs team discussed this today. What we plan to do is basically what the original post says; but we want to make sure that we do it in a way that suggests common errors rather than hard-specifying that it can only return one of them. The practical consideration is that the "common" errors will not be the exhaustive list, but that doesn't paint anyone into a corner later. |
Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
…r=GuillaumeGomez Document possible `io::ErrorKind`s of `fs::open` Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC rust-lang#40322
Triage: no changes. Vaguely conceptually similar to #24795 |
@steveklabnik I was just browsing through some older T-docs issues, just to get an idea of everything that is still running (and hopefully help a bit in cleaning up stuff!). And then I saw that the Maybe we can "solve" this issue by taking one of the following approaches?:
I wonder what your thoughts are on this! I might be able to pick this up completely (or partly depending on the amount of work :)) |
I've seen that, it's been great 😄
Yes, this is not what the issue is talking about, though :) It seems you know that, but just to be clear.
I don't think this is necessary because
This is what the bug is talking about. And putting it above and below seems like too much to me. But it's also not about "commonly thrown" errors, it's about enumerating which possible errors can be returned from a particular function. Basically, That being said, similar to the other issue we had, I'd like @rust-lang/libs to weigh in; is this something you'd want to see? If we document this, it becomes part of the API contract, so such a project would have to work hand in hand with them.
Yep, this is also a possibility. It doesn't seem like there's been huge demand for this. |
@steveklabnik Ahh thanks for the clarification! I think my brain mixed things up a bit while reading other issues. I can imagine that some platforms generate errors which others do not, so it might be tough to create a hard contract for each method but let's wait for the Libs Team to shine their light on this :) |
@steveklabnik Sorry for spamming you with this question, but when I try to ping @rust-lang/libs it fails to work. Is this because it only works for members that are part of the Rust organization? I was also wondering!: It's about a month ago now, what are normal durations for pinging a team or member again if no response was received? It would be nice if the libs team can comment on this such that we can pick it up :) |
From quickly skimming this issue, here's my take:
cc @rust-lang/libs (since @DevQps's ping didn't work). |
I personally agree with @BurntSushi in that listing common errors sounds good, but we should not strive to provide an exhaustive list. |
@alexcrichton Thanks for your response! I think two more questions remain for me now:
I can pick this up if no one else wants to! |
I think if you just stick to listing the errors that might occur in terms of I would like to re-iterate my question of the usefulness of these docs though. If we provide a non-exhaustive non-guaranteed list of errors, what purpose does it serve? i.e., What would people use that information for?
I guess it would be any routine that returns an |
@BurntSushi Personally I wonder how useful it would be as well. I do believe it can be slightly useful for beginners to catch common cases (such as NotFound, or PermissionDenied) but I wonder if it is worth all this extra work. I see the following pro's and con's: Pro's:
Con's:
I feel a bit 50/50 about this :) I wonder what @alexcrichton and @steveklabnik think about this however. If they still believe we should list the common errors of |
At the very least, error types that are necessary to handle for correctness should be documented. e.g. #34661 |
I wonder if the variants of |
Sounds great to me; let's take that approach. |
See this reddit post where the question was "How can
File::open
fail?" and the information is sort of there in the docs, but I was reduced to guessingio::ErrorKind
variants from the text description of errors. Similar to how Unix man pages list exactly whicherrno
values are possible, thestd::io
functions should list the exact variants they might return.The text was updated successfully, but these errors were encountered: