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 UnexpectedOutput to IoErrorKind (or something similar) #13882

Closed
carllerche opened this issue May 1, 2014 · 4 comments
Closed

Add UnexpectedOutput to IoErrorKind (or something similar) #13882

carllerche opened this issue May 1, 2014 · 4 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@carllerche
Copy link
Member

This would help support any higher level IO abstractions, such as parsers, or wrappers around process calls, etc...

For example, an abstraction that shims execing sub processes and handling the result could fail w/ UnexpectedOutput if the subprocess did not provide a valid result.

Another use-case, when wrapping an IO stream w/ an HTTP parser (or any higher level protocol), it would be nice to just return an IO like API, but when failing to parse, there is no good IoErrorKind to describe failing to handle the output in the abstraction.

@alexcrichton
Copy link
Member

I've been using InvalidInput for situations such as this, do you think that this is distinct enough from that kind?

@carllerche
Copy link
Member Author

InvalidInput implies to me that what I provided the API was incorrect. UnexpectedOutput would be the reverse.

Whether they are distinct enough, I don't know. I didn't think it was appropriate to use InvalidInput.

@steveklabnik steveklabnik added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Apr 20, 2015
@steveklabnik
Copy link
Member

Triage: no change

@Mark-Simulacrum
Copy link
Member

io::ErrorKind::InvalidData has the following description:

Data not valid for the operation were encountered.

Unlike InvalidInput, this typically means that the operation parameters were valid, however the error was caused by malformed input data.

For example, a function that reads a file into a string will error with InvalidData if the file's contents are not valid UTF-8.

I think this fits the described UnexpectedOutput, so can this be closed?

arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
Write down adjustments introduced by binary operators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

5 participants