Skip to content

Provide introspection on hyper::Error #1542

@jonhoo

Description

@jonhoo

I have an application in which I want to try to set up a server on a specific port, but if that port is taken (i.e., an AddrInUse error is raised), it should fall back to any port (i.e., port 0). Unfortunately, since hyper's error type is now opaque (as of 5d3c472), I can no longer easily see if that was the cause of an error raised by Server::try_bind.

While I could construct a TcpListener myself and then pass that listener's Incoming to Server::builder, that's an unfortunate amount of extra boilerplate. Perhaps it would make sense to expose an as_io_error(&self) -> Option<&io::Error> on hyper::Error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-errorArea: error handlingB-rfcBlocked: More comments would be useful in determine next steps.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions