Skip to content

Add UnexpectedOutput to IoErrorKind (or something similar) #13882

Closed
@carllerche

Description

@carllerche
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.

Activity

alexcrichton

alexcrichton commented on May 1, 2014

@alexcrichton
Member

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

carllerche

carllerche commented on May 1, 2014

@carllerche
MemberAuthor

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.

added
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
on Apr 20, 2015
steveklabnik

steveklabnik commented on Apr 20, 2015

@steveklabnik
Member

Triage: no change

Mark-Simulacrum

Mark-Simulacrum commented on Sep 18, 2016

@Mark-Simulacrum
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?

added a commit that references this issue on Jan 9, 2023

Auto merge of rust-lang#13882 - Veykril:bin-op-adjust, r=Veykril

added a commit that references this issue on Jan 9, 2025
b57d98b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @carllerche@steveklabnik@alexcrichton@sfackler@Mark-Simulacrum

        Issue actions

          Add UnexpectedOutput to IoErrorKind (or something similar) · Issue #13882 · rust-lang/rust